Dashboards & Visualizations

How can I show different colors to match specific ranges on a single value dashboard panel?

barunbiswas
New Member

I am working on a single value dashboard panel where I am showing results in percentage. I want to show different range in different colors. So, I have defined the below range:
min to 30.99 -> green
30.99 to 60.99 -> yellow
60.99 to 89.99 -> amber
89.99 to max -> red
in the XML form, there are 4 values inside rangeColors (green, yellow, amber, red) and 3 values (30.99, 60.99, 89.99) inside rangeValues.

The above definition is showing 0.00 in red (!), when it should be shown in green. Could you advise me on this please?

0 Karma

riddhichandaran
Explorer

Hey @barunbiswas
please try below code, hope it will help you!

<dashboard>
  <label>splunk_answer</label>
  <row>
    <panel>
      <single>
        <search>
          <query>index=_internal | stats count | eval count=0</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
        <option name="numberPrecision">0.00</option>
        <option name="rangeColors">["0x53a051","0xFFFF00","0xffbf00","0xdc4e41"]</option>
        <option name="rangeValues">[30.99,60.99,89.99]</option>
        <option name="refresh.display">progressbar</option>
        <option name="useColors">1</option>
      </single>
    </panel>
  </row>
</dashboard>

alt text

0 Karma

niketn
Legend

@barunbiswas, can you share the other Single Value Simple XML Configuration options? By any chance have you chosen the option to color by trend?

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

Sukisen1981
Champion

hi, can you share the xml piece of code where you are doing this?
As it is of course , this looks perfect but it would be better to see your xml code where you are setting the range colours

0 Karma

barunbiswas
New Member

Please find below the xml code for this.

["0x65a637","0xf7bc38","0xf58f39",0xd93f3c"]
[30.99,60.99,89.99]

0 Karma

alemarzu
Motivator

Did you try by changing them from the UI ?

0 Karma

barunbiswas
New Member

yes, tried. However, it is not working correctly always. Here, I am saying always because sometimes it showing color correctly, sometimes not. It seems something is not correct with the Splunk options itself, however, not sure.

0 Karma

cmerriman
Super Champion

i created a dashboard using |makeresults|eval data=0.00 and put those values into my format and it seems to work. I'm using Splunk v 6.6.2. what version are you on? This might be worth a support ticket.

<dashboard>
  <label>randomtest</label>
  <row>
    <panel>
      <single>
        <search>
          <query>|makeresults|eval data=0.00</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
        <option name="numberPrecision">0.00</option>
        <option name="rangeColors">["0x65a637","0x6db7c6","0xf7bc38","0xd93f3c"]</option>
        <option name="rangeValues">[30.99,60.99,89.99]</option>
        <option name="useColors">1</option>
      </single>
    </panel>
  </row>
</dashboard>
0 Karma
Get Updates on the Splunk Community!

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Accelerating Observability as Code with the Splunk AI Assistant

We’ve seen in previous posts what Observability as Code (OaC) is and how it’s now essential for managing ...