Dashboards & Visualizations

Changing column colors in a Column Chart based on threshold

agrant21
Loves-to-Learn

Hi, 

I am trying to create a column chart that if the value is greater than 3 then the column of the Column chart turns red while if the value is less than or equal to 3, the column of the chart is green. 

Below is my search that I started off with:

index | timechart span=5m avg(totalTime) as avg_value limit=20
| eval threshold=3

I tried:

index | timechart span=5m avg(totalTime) as avg_value limit=20
| eval threshold=3
| eval "red"=if(avg_value > threshold, avg_value,0)
| eval "green"=if(avg_value<threshold, avg_value,0)
|fields - avg_value


Then I went into the source code and defined the colors but the column chart did not change colors.  

 <option name="charting.fieldColors">{"red":0xFF0000,"green":0x73A550}</option>

 I do not want the columns stacked. 

Kindly help. 

Labels (3)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Have you tried series colors rather than fieldColors?

0 Karma

agrant21
Loves-to-Learn

I figured it out. I added if statements in my search x=if(avg <= threshold, avg,0) and then went to the source code and assigned x a color. 

0 Karma
Get Updates on the Splunk Community!

Enter the Dashboard Challenge and Watch the .conf24 Global Broadcast!

The Splunk Community Dashboard Challenge is still happening, and it's not too late to enter for the week of ...

Join Us at the Builder Bar at .conf24 – Empowering Innovation and Collaboration

What is the Builder Bar? The Builder Bar is more than just a place; it's a hub of creativity, collaboration, ...

Combine Multiline Logs into a Single Event with SOCK - a Guide for Advanced Users

This article is the continuation of the “Combine multiline logs into a single event with SOCK - a step-by-step ...