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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...