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!

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...