Dashboards & Visualizations

Displaying string value in pie chart

gmishra
New Member

I use multiple saves searches from different chart to display overall application health status. The chart works fine for me accept it only shows colors. I am working to display the string value (green, yellow, red) on the pie chart but it doesnt work as expected.

Splunk pie chart (somehow) never displays the color name on the chart. I was wondering if there is a way to display the value on the chart. I tried to use the single value chart but looks like it adds colors only for numerical values and not for string.

Please help me understand if anyone of you have achieved this in Splunk. Here are some additional details.

<panel>
  <chart>
    <title>Agent Portal</title>
    <search>
      <query>
        | savedsearch "A" 
        | append [ | savedsearch "B"] 
        | append [ | savedsearch "C"]
        | append [ | savedsearch "D"]
        | append [ | savedsearch "E"]
        | append [ | savedsearch "F"]
        | append [ | savedsearch "G"] 
        | eval overall_health = min(availability_severity, performance_severity, apdex_severity, report_GCPA_severity, report_NBP_severity, report_OReq_severity, report_PGA_severity) 
        | stats min(overall_health) as severity 
        | eval color=case(severity="1","red",severity="2","yellow",severity="3","green") 
        | chart count by color
      </query>
      <earliest>-15m</earliest>
      <latest>now</latest>
      <refresh>60s</refresh>
      <refreshType>delay</refreshType>
    </search>
    <option name="charting.chart">pie</option>
    <option name="charting.chart.showLabels">0</option>
    <option name="height">100</option>
    <option name="charting.fieldColors">{"red":0xff0000,"yellow":0xffc300,"green":0x65a637}</option>
    <drilldown>
      <link target="_blank">/app/search/application_health__agent_portal</link>
    </drilldown>
  </chart>
</panel>
Tags (2)
0 Karma

koshyk
Super Champion

Similar question already answered in here: https://answers.splunk.com/answers/71090/how-to-display-the-count-in-piechart-as-labels.html

Basically, Simple two options
1. show as percent

 <option name="charting.chart.showPercent">true</option>

2.Trick to include the value as a string

.. | stats count by severity | eval severity_slice = count + " " + severity | fields severity_slice, count
Get Updates on the Splunk Community!

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...