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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...