Dashboards & Visualizations

How to assign colors to slices of a pie chart on a dashboard when the number of slices vary?

waardd
Engager

I want to assign specific colors to pie-parts even when the number of pie-parts vary from 1 to 5 parts.
Error parts are not always in the pie, but must always be red.
Completed part is always in the pie and must always be green.

There are two kinds of errors that are not always in the pie chart, but as mentioned must always get the same color.

How can i make this work?

code example of 1 piechart in the dashboard:

 <panel>
      <title>Extern (DLL) Async</title>
      <chart>
        <title>G (BKR)</title>
        <search>
          <query>index = fake-index sourcetype = fake-sourcetype source = /something/application.log "*Check execution performance*" AND ";G;" | table SoortToets , UitkomstToets | stats count(SoortToets) by UitkomstToets</query>
          <earliest>-15m</earliest>
        </search>
<!--        <option name="charting.seriesColors">[0xD0FFA1,0xFFDD00,0x00C3FF,0xFFA1A1,0xFF0000]</option> -->
        <option name="charting.axisLabelsX.majorLabelStyle.overflowMode">ellipsisNone</option>
        <option name="charting.axisLabelsX.majorLabelStyle.rotation">0</option>
        <option name="charting.axisTitleX.visibility">visible</option>
        <option name="charting.axisTitleY.visibility">visible</option>
        <option name="charting.axisTitleY2.visibility">visible</option>
        <option name="charting.axisX.scale">linear</option>
        <option name="charting.axisY.scale">linear</option>
        <option name="charting.axisY2.enabled">0</option>
        <option name="charting.axisY2.scale">inherit</option>
        <option name="charting.chart">pie</option>
        <option name="charting.chart.bubbleMaximumSize">50</option>
        <option name="charting.chart.bubbleMinimumSize">10</option>
        <option name="charting.chart.bubbleSizeBy">area</option>
        <option name="charting.chart.nullValueMode">gaps</option>
        <option name="charting.chart.showDataLabels">none</option>
        <option name="charting.chart.sliceCollapsingThreshold">0.01</option>
        <option name="charting.chart.stackMode">default</option>
        <option name="charting.chart.style">shiny</option>
        <option name="charting.drilldown">all</option>
        <option name="charting.layout.splitSeries">0</option>
        <option name="charting.layout.splitSeries.allowIndependentYRanges">0</option>
        <option name="charting.legend.labelStyle.overflowMode">ellipsisMiddle</option>
        <option name="charting.legend.placement">right</option>
      </chart>
    </panel>
1 Solution

hylam
Contributor

http://docs.splunk.com/Documentation/Splunk/6.3.1/Viz/Chartcustomization

  <option name="charting.legend.labels">[error,warn,info]</option>
  <option name="charting.seriesColors">[0xFF0000,0xFFFF00,0x00FF00]</option>

View solution in original post

hylam
Contributor

http://docs.splunk.com/Documentation/Splunk/6.3.1/Viz/Chartcustomization

  <option name="charting.legend.labels">[error,warn,info]</option>
  <option name="charting.seriesColors">[0xFF0000,0xFFFF00,0x00FF00]</option>

jotne
Builder

A better way to do this that will always works correctly: (tested in 9.0.5)

<option name="charting.fieldColors">{"error":#FF0000,"warn":FFFF00,"info":00FF00}</option>
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...