Splunk Search

Is it possibile to display zero value label on chart?

andrewtrobec
Motivator

Hello,
I've seen similar questions like this one, but not exactly what I'm looking for. I've managed to create buckets in the chart where those buckets don't have values, but what I'd like to do is add the zero label as well (the "Show Data Values" option). Here is an image showing what I mean:

alt text

Is this possible? Is there some CSS code that will allow me to do it?

Thanks!

Andrew

0 Karma
1 Solution

vnravikumar
Champion

Hi

Try this

<dashboard>
  <label>chart data</label>
  <row depends="$hide$">
    <html>
      <style>
      #rk  g [class="highcharts-label highcharts-data-label highcharts-data-label-color-undefined "]{
        display: block;

        }
      </style>
    </html>
  </row>
  <row>
    <panel>
      <chart id="rk">
        <search>
          <query>| makeresults 
| eval a=45,b=0,c=0,d=9 |table a,b,c,d | transpose 0</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="charting.chart">column</option>
        <option name="charting.chart.showDataLabels">all</option>
        <option name="charting.drilldown">none</option>
        <option name="charting.axisY.includeZero">true</option>
      </chart>
    </panel>
  </row>
   <row>
    <panel>
      <chart>
        <search>
          <query>| makeresults 
| eval a=45,b=0,c=0,d=9 |table a,b,c,d | transpose 0</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="charting.chart">column</option>
        <option name="charting.chart.showDataLabels">all</option>
        <option name="charting.drilldown">none</option>
        <option name="charting.axisY.includeZero">true</option>
      </chart>
    </panel>
  </row>
</dashboard>

View solution in original post

vnravikumar
Champion

Hi

Try this

<dashboard>
  <label>chart data</label>
  <row depends="$hide$">
    <html>
      <style>
      #rk  g [class="highcharts-label highcharts-data-label highcharts-data-label-color-undefined "]{
        display: block;

        }
      </style>
    </html>
  </row>
  <row>
    <panel>
      <chart id="rk">
        <search>
          <query>| makeresults 
| eval a=45,b=0,c=0,d=9 |table a,b,c,d | transpose 0</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="charting.chart">column</option>
        <option name="charting.chart.showDataLabels">all</option>
        <option name="charting.drilldown">none</option>
        <option name="charting.axisY.includeZero">true</option>
      </chart>
    </panel>
  </row>
   <row>
    <panel>
      <chart>
        <search>
          <query>| makeresults 
| eval a=45,b=0,c=0,d=9 |table a,b,c,d | transpose 0</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="charting.chart">column</option>
        <option name="charting.chart.showDataLabels">all</option>
        <option name="charting.drilldown">none</option>
        <option name="charting.axisY.includeZero">true</option>
      </chart>
    </panel>
  </row>
</dashboard>

andrewtrobec
Motivator

@vnravikumar amazing, this works perfectly, thank you so much! Follow-up question: is there a way to have this work on all charts on a dashboard without have to assign ids to all of them?

0 Karma

vnravikumar
Champion

Welcome, you can apply to all chart by removing the id in the CSS

0 Karma
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI! Discover how Splunk’s agentic AI ...

[Puzzles] Solve, Learn, Repeat: Dereferencing XML to Fixed-length events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

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

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...