Dashboards & Visualizations

How do I change a panel's single value color using XML?

damucka
Builder

Hello,

Could you perhaps help me to change the color of the single value?

I would like to have a static blue color without ranges or any dependencies.

I tried to implement it as follows, but it did not work:

<html>
        <style type="text/css">
           #LogBackupWithCSS1 .dashboard-panel .single-value .single-result {
             font-size: 40px !important;
             color: #0877A6 !important;
           }
        </style>
</html>

The font size gets changed correctly by the above, but the font color does not.

Kind Regards,
Kamil

Tags (2)
0 Karma

niketn
Legend

@damucka if you want static color, you should try the following (without having to use CSS)

        <option name="rangeColors">["0x0877A6","0x0877A6"]</option>
        <option name="rangeValues">[0]</option>
        <option name="colorBy">value</option>

With the colorMode as none or block (for example):

       <option name="colorMode">block</option>

Following is a run anywhere example for the same:

<dashboard>
  <label>Single Value Static Color</label>
  <row>
    <panel>
      <single>
        <title>Result Color Blue: 0x0877A6</title>
        <search>
          <query>index=_internal sourcetype=splunkd log_level!=INFO
|  stats count</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="colorBy">value</option>
        <option name="colorMode">none</option>
        <option name="drilldown">none</option>
        <option name="numberPrecision">0</option>
        <option name="rangeColors">["0x0877A6","0x0877A6"]</option>
        <option name="rangeValues">[0]</option>
        <option name="showSparkline">1</option>
        <option name="showTrendIndicator">1</option>
        <option name="trellis.enabled">0</option>
        <option name="trellis.scales.shared">1</option>
        <option name="trellis.size">medium</option>
        <option name="trendColorInterpretation">standard</option>
        <option name="trendDisplayMode">absolute</option>
        <option name="unitPosition">after</option>
        <option name="useColors">1</option>
        <option name="useThousandSeparators">1</option>
      </single>
    </panel>
    <panel>
      <single>
        <title>Block Color 0x0877A6</title>
        <search>
          <query>index=_internal sourcetype=splunkd log_level!=INFO
|  stats count</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="colorBy">value</option>
        <option name="colorMode">block</option>
        <option name="drilldown">none</option>
        <option name="numberPrecision">0</option>
        <option name="rangeColors">["0x0877A6","0x0877A6"]</option>
        <option name="rangeValues">[0]</option>
        <option name="showSparkline">1</option>
        <option name="showTrendIndicator">1</option>
        <option name="trellis.enabled">0</option>
        <option name="trellis.scales.shared">1</option>
        <option name="trellis.size">medium</option>
        <option name="trendColorInterpretation">standard</option>
        <option name="trendDisplayMode">absolute</option>
        <option name="unitPosition">after</option>
        <option name="useColors">1</option>
        <option name="useThousandSeparators">1</option>
      </single>
    </panel>
  </row>
</dashboard>
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@damucka

If you want to fix single value color in XML then range option will help you without specifying any range. Please try below xml option in you single view.

<option name="rangeColors">["0x0000ff","0x0000ff"]</option>
<option name="rangeValues">[0]</option>
<option name="useColors">1</option>

Sample Code

 <single>
        <search>
          <query>| stats count</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
        <option name="rangeColors">["0x0000ff","0x0000ff"]</option>
        <option name="rangeValues">[0]</option>
        <option name="useColors">1</option>
      </single>

If still, you want to go with CSS then pls let me know.

Thanks

niketn
Legend

Did not notice that it was already answered before I had posted my answer 🙂

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
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 ...