Dashboards & Visualizations

How to customize assigned colors with dynamic labels from a pie chart?

splunkrocks2014
Communicator

I don't have any problems to show the pie chart with assigned colors with the fixed labels by just adding the following line to the Simple XML:

<option name="charting.fieldColors">{"P1":0xFFC000,"P2":0x000000,"P3":0x92D050,"P4":0x7030A0,"P5":0xFF0000}</option>

However, labels are changed by concatenated with count and percentage, for instance, "P1" is now changed to "P1 (count:12, perc: 24%)". I tried using wildcard such as:

<option name="charting.fieldColors">{"P1*":0xFFC000,"P2*":0x000000,"P3*":0x92D050,"P4*":0x7030A0,"P5*":0xFF0000}</option>

but it doesn't work. Does anyone have any clues?

Thanks

0 Karma

benhooper
Communicator

I'd like to be able to do this too. Did anyone ever find a solution?

0 Karma

shuta1981
New Member

I had a same problem and realized wildcard * won't work in charting.fieldColors.

0 Karma

niketn
Legend

@shuta1981... Can you also try charting.seriesColors instead of charting.fieldColors?

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

niketn
Legend

@splunkrocks2014... You can use charting.seriesColors to define 5 series colors. Since your fieldnames would still be in the same sequence i.e. P1,P2,P3 etc... All you need to make sure is that any series data which is not present should be 0 so that next series does not pick the missing field color.

 <option name="charting.seriesColors">[0xFFC000,0x000000,0x92D050,0x7030A0,0xFF0000]</option>
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

shuta1981
New Member

Try the below code. However, this only works as long as filtering is not used. If filtering is used, color for a particular label will be different depending on how you filter.

["P1*", "P2*", "P3*", "P4*", "P5*"]

[0xFFC000, 0x000000, 0x92D050, 0x7030A0, 0xFF0000]

0 Karma
Get Updates on the Splunk Community!

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

New Release | Splunk Cloud Platform 10.1.2507

Hello Splunk Community!We are thrilled to announce the General Availability of Splunk Cloud Platform 10.1.2507 ...

🌟 From Audit Chaos to Clarity: Welcoming Audit Trail v2

&#x1f5e3; You Spoke, We Listened  Audit Trail v2 wasn’t written in isolation—it was shaped by your voices.  In ...