Dashboards & Visualizations

Add Color to a Single Value Chart

Hppjet
Path Finder

I am trying to add color to a single value chart. The 1000 is the goal and it changes based on the number of days the search pulls.
Here is my search.

index=Foo ShiftName=1 MachineNumber<26 NumberOfGGRollPaths ElapsedMachineFootageInOrderPath
| eval "Square Yards"= (NumberOfGGRollPaths * ElapsedMachineFootageInOrderPath)*0.66667
| stats dc(_time) as numberofuniquedays sum("Square Yards") as SQYDS
| chart sum(SQYDS)
| eval Scale = (SQYDS/(numberofuniquedays * 1000))
| rangemap field=Scale green=1000-1 yellow=0.8-0.5 red=0.5-0

I can't get the chart to change a color. Please help.

Tags (1)
0 Karma

mdsnmss
SplunkTrust
SplunkTrust

I'm not sure if there is a way to do this within the search itself but you can do it by editing the dashboard panel XML. Here is a link to the single value XML options for reference: http://docs.splunk.com/Documentation/Splunk/latest/Viz/PanelreferenceforSimplifiedXML#single_value

What this might look like is:

     <panel>
      <title>Panel Title</title>
      <single>
        <search>
          <query>index=Foo ShiftName=1 MachineNumber<26 NumberOfGGRollPaths ElapsedMachineFootageInOrderPath
| eval "Square Yards"= (NumberOfGGRollPaths * ElapsedMachineFootageInOrderPath)0.66667 
| stats dc(_time) as numberofuniquedays sum("Square Yards") as SQYDS 
| chart sum(SQYDS)
| eval Scale = (SQYDS/(numberofuniquedays 1000)) 
| rangemap field=Scale green=1000-1 yellow=0.8-0.5 red=0.5-0</query>
        </search>
        <option name="colorBy">value</option>
        <option name="field">Scale</option>
        <option name="useColors">true</option>
        <option name="rangeColors">#00ff00,#ffffe0,#ff0000</option>
        <option name="rangeValues">999,0.8,0.5</option>
      </single>
    </panel>

This might take a little bit of tweaking yet but is the general idea. There are other options available for the Single Value viz documented in those XML docs as well.

0 Karma
Get Updates on the Splunk Community!

Build Scalable Security While Moving to Cloud - Guide From Clayton Homes

 Clayton Homes faced the increased challenge of strengthening their security posture as they went through ...

Mission Control | Explore the latest release of Splunk Mission Control (2.3)

We’re happy to announce the release of Mission Control 2.3 which includes several new and exciting features ...

Cloud Platform | Migrating your Splunk Cloud deployment to Python 3.7

Python 2.7, the last release of Python 2, reached End of Life back on January 1, 2020. As part of our larger ...