Dashboards & Visualizations

How to change the color of a whole panel based on a single value result in Splunk 6.2.1?

kpsg25690
Engager

Hello,

I'm creating a dashboard using Splunk 6.2.1 which will have multiple single value panels, each with a value of YES or NO and a drilldown to a different dashboard.

I am able to change the text color using the "severe" and "low" default classes and also the background color using the same, but I want to change the background of the whole panel instead of the single value component.

My xml is:

<dashboard script="hc.js" stylesheet="hc.css">
  <label>Health_Check_Dashboard</label>
  <row>
    <panel>
      <single id="one">
        <title>1 Status</title>
        <search>
          <query>index=event* sourcetype=<sourcetype> CellName=<name> | head 1| eval result=if(PrimaryRunning=="NO" OR SecondaryRunning=="NO","NO","YES") | eval class=if(PrimaryRunning=="NO" OR SecondaryRunning=="NO","severe","low") | table result,class</query>
          <earliest>0</earliest>
          <latest></latest>
        </search>
        <option name="classField">class</option>
        <option name="drilldown">none</option>
        <option name="useColors">1</option>
      </single>
    </panel>
    <panel>
        <single id="two">
        <title>2 Status</title>
        <search>
          <query>index=event* sourcetype=<sourcetype> CellName=<name> | head 1| eval result=if(PrimaryRunning=="NO" OR SecondaryRunning=="NO","NO","YES") | eval class=if(PrimaryRunning=="NO" OR SecondaryRunning=="NO","severe","low") | table result,class</query>
          <earliest>0</earliest>
          <latest></latest>
        </search>
        <option name="classField">class</option>
        <option name="drilldown">none</option>
        <option name="useColors">1</option>
      </single>
    </panel>
    <panel>
      <single id="three">
        <title>3 Status</title>
        <search>
          <query>index=event* sourcetype=<sourcetype> CellName=<name> | head 1| eval result=if(PrimaryRunning=="NO" OR SecondaryRunning=="NO","NO","YES") | eval class=if(PrimaryRunning=="NO" OR SecondaryRunning=="NO","severe","low") | table result,class</query>
          <earliest>0</earliest>
          <latest></latest>
        </search>
        <option name="classField">class</option>
        <option name="drilldown">none</option>
        <option name="useColors">1</option>
      </single>
    </panel>
  </row>
  </dashboard>

I've gone through the other examples in here and the dashboard examples and couldn't find anything that works.

Any help would be appreciated.

Thanks!

0 Karma

jnichols914
Explorer

I don't know if you figured this out already, but you want to use the following as an option "Block". When you do this, your background will change based on the colors you specified and your text will stay white.

Hope this helps,

Justin

<option name="colorBy">value</option>
 <option name="colorMode">block</option>
0 Karma
Get Updates on the Splunk Community!

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Shape the Future of Splunk: Join the Product Research Lab!

Join the Splunk Product Research Lab and connect with us in the Slack channel #product-research-lab to get ...