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>
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...