Dashboards & Visualizations

How to apply a default colour to a single-line visual box with text instead of numbers

mansel_scheffel
Explorer

Hi,

I need to change the default colour of a group of single line visuals..They are pulling in text from a lookup.. The default colour needs to be red, not black, but as there are no numeric values, the range obviously doesnt work.

Any thoughts on how I can set a default colour?

0 Karma
1 Solution

kbarker302
Communicator

One approach would be to add something like the following to the end of your query:

| eval color=1 | rangemap field=color default=severe   

and add this option to your single value XML:

<option name="classField">color</option>

Below is a complete example that worked for me:

  <single>
    <search>
      <query>index=_internal | head 1 | eval myday=strftime(_time,"%A")             
        | fields myday          
        | eval color=1 | rangemap field=color default=severe 
      </query>
      <earliest></earliest>
      <latest></latest>
    </search>
    <option name="classField">color</option>
  </single>

This is a variation of an approach that is described here:

https://answers.splunk.com/answers/103239/change-color-of-single-value-visualization.html

Depending on how comfortable you are with CSS, another approach would be to include a custom CSS file that overrides the single-result class.

View solution in original post

0 Karma

kbarker302
Communicator

One approach would be to add something like the following to the end of your query:

| eval color=1 | rangemap field=color default=severe   

and add this option to your single value XML:

<option name="classField">color</option>

Below is a complete example that worked for me:

  <single>
    <search>
      <query>index=_internal | head 1 | eval myday=strftime(_time,"%A")             
        | fields myday          
        | eval color=1 | rangemap field=color default=severe 
      </query>
      <earliest></earliest>
      <latest></latest>
    </search>
    <option name="classField">color</option>
  </single>

This is a variation of an approach that is described here:

https://answers.splunk.com/answers/103239/change-color-of-single-value-visualization.html

Depending on how comfortable you are with CSS, another approach would be to include a custom CSS file that overrides the single-result class.

0 Karma

MaryvonneMB
Path Finder

I'm not sure what single-line visual is, but if you have it in a dashboard you can deal with options in SimpleXML:
try to add
<option name="charting.seriesColors">[990000]</option>to your chart
http://docs.splunk.com/Documentation/Splunk/6.4.1/Viz/ChartConfigurationReference

0 Karma
Get Updates on the Splunk Community!

Video | Welcome Back to Smartness, Pedro

Remember Splunk Community member, Pedro Borges? If you tuned into Episode 2 of our Smartness interview series, ...

Detector Best Practices: Static Thresholds

Introduction In observability monitoring, static thresholds are used to monitor fixed, known values within ...

Expert Tips from Splunk Education, Observability in Action, Plus More New Articles on ...

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