Dashboards & Visualizations

Colouring Piecharts created using JSChart

cmak
Contributor

I create a piechart that has these results in tabular form.

Type    count

1 Pass 0
2 Failed 14
3 Uncovered 0

It has 3 sections, Pass, Failed, Uncovered.
In the above example, Failed = 100% of the piechart.
I would like to colour it so that Pass is green, Failed is pink and Uncovered is Red

I have tried two different code

<module name="HiddenChartFormatter">
                                   <param name="chart">pie</param>
                                  <param name="charting.fieldColors">{"Pass":0x009933,"Failed":0xff6ff2,"Uncovered":0xe00707}</param>

This does not work with JSChart.

<param name="charting.seriesColors">[0x009933, 0xff6ff2, 0xe00707]</param>

Using seriesColors does not tie a colour to a value, so in the above piechart, Failed would be green as it is the only field that shows up in the piechart.

Am I doing something wrong with fieldColors?

Tags (1)

kikexclusive
Path Finder
0 Karma

rhapsody2046
Explorer

I currently meet the same problem coloring JSChart but it is not working.
Solution 1:
{"Available Storage":0x0099FF, "Used Storage(status:critical)":0xFF0000,"Used Storage(status:too high)":0xFFFF00, "Used Storage(status:normal)":0x00CC00}

Solution 2:
[0x0099FF,0xFF0000,0xFFFF00,0x00CC00]
["Available Storage", "Used Storage(status:critical)", "Used Storage(status:too high)", "Used Storage(status:normal)"]

They both do not work, not all the colors are mapped correctly.

I see several posts here but not really a final solution.
Does anyone know a solution.

Simon
Contributor

I had pretty much the same issue and ended up by configuring the legend labels manually in the HiddenChartFormatter:

<param name="charting.legend.labels">[Info, Low, Medium, High, Critical, Fatal]</param>
<param name="charting.seriesColors">[0x999999,0x5378AD,0x98BF3B,0xF0BE1B,0xFF8800,0xD25B3B]</param>

HTH.
Simon

0 Karma

0waste_splunk
Communicator

hey cmak,

did you solve this problem? if so can you please share your work around?

Thanks

0 Karma

cmak
Contributor

The field is created in the search. It is just when the value is ', the piechart does not show it, and it does not count as a field although it is present.

This is what the table looks like :

Type    count

1 Pass 0
2 Failed 0
3 Uncovered 1

The piechart just will show 100% uncovered

0 Karma

Simon
Contributor

How about creating the field anyway in your search, even if there's no content, e.g. with fillnull() ? --> http://docs.splunk.com/Documentation/Splunk/5.0.2/SearchReference/Fillnull

0 Karma

cmak
Contributor

The problem with my query is that Of the three fields I have (Pass, Failed, Uncovered), they may not all be present. When pass is not present, then failed label will receive the first color.

The legend.labels does not change this fact.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...