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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...