Splunk Search

How do I change the color of a pie graphic for each unique value?

bruno_eduardo
Path Finder

I have a Risk field with this possible values (Critical, High, Medium, Low) and I want to be red when critical, high is purple, yellow medium and green low.

I would like to do this in the query itself, if it is not possible , let´s do it on xml!!!

Here is the xml:

<chart>
  <title>Severidade - Vulnerabilidades Vencidas</title>
  <searchString>index="patches" earliest=@d latest=now  Estado=Vencida OR Estado=Expired NOT Descripci_xF3n="EHT*" NOT Title="EHT*" NOT GrupoName2="DS - PROJETOS"  | stats count by Risk</searchString>
  <earliestTime>0</earliestTime>
  <latestTime>now</latestTime>
  <option name="charting.axisTitleX.visibility">visible</option>
  <option name="charting.axisTitleY.visibility">visible</option>
  <option name="charting.axisX.scale">linear</option>
  <option name="charting.axisY.scale">linear</option>
  <option name="charting.chart">pie</option>
  <option name="charting.chart.nullValueMode">gaps</option>
  <option name="charting.chart.sliceCollapsingThreshold">0.01</option>
  <option name="charting.chart.stackMode">default</option>
  <option name="charting.chart.style">minimal</option>
  <option name="charting.drilldown">all</option>
  <option name="charting.layout.splitSeries">0</option>
  <option name="charting.legend.labelStyle.overflowMode">ellipsisMiddle</option>
  <option name="charting.legend.placement">right</option>
  <option name="wrap">true</option>
  <option name="rowNumbers">false</option>
  <option name="dataOverlayMode">none</option>
  <option name="drilldown">cell</option>

Thanks in advance

Tags (4)
0 Karma
1 Solution

tom_frotscher
Builder

Hi, you can use the option charting.seriesColor.

See the second example for chart colors in this part of the documentation for your usecase: Link

View solution in original post

tom_frotscher
Builder

Hi, you can use the option charting.seriesColor.

See the second example for chart colors in this part of the documentation for your usecase: Link

jeremiahc4
Builder

A slightly less blinding green & red (more Christmas'y)

<option name="charting.legend.labels">["Bad Stuff","Good Stuff"]</option>
<option name="charting.seriesColors">[0x088A08,0xDF0101]</option>

Oddly I am confused on why the order of the labels doesn't match the order of the colors? I just copied that directly from a dashboard (redacting only the verbage) and it shows "Bad Stuff" as 0xDF0101 (slightly dark red).

0 Karma

jeremiahc4
Builder

And I'm even further confused as I just looked at another panel on the same dashboard which shows a different order being picked up.

<option name="charting.legend.labels">["Other Bad Stuff","Other Good Stuff"]</option>
<option name="charting.seriesColors">[0xDF0101,0x088A08]</option>
0 Karma

jeremiahc4
Builder

Disregard, just read further on that link and found why. Now to figure out how to use that masterLegend property I guess.

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...