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!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...