Dashboards & Visualizations

change the color of a single value panel based on time

sravani27
Path Finder

Hi guys, I am trying to change the color of a single value panel based on the timestamp.
Eg: if the count is > 5 from 12 am - 8 am - the panel should be green, and if the count is > 5 from 8 am - 6 pm - the panel should be red.
I am trying to dynamically change the colors based on the timerange
Please help.

Tags (1)

niketn
Legend

@sravani27 please add more details to your use case. What happens for 6:00 PM to midnight? Also what is count is <5 what happens during all the timings?

What is the query to fetch count? Could you please add some sample data and SPL? Please mock/anonymize any sensitive information. I your count some kind of count for current hour and based on hour of the day you want to color the count?

In order for the community to assist you better please provide further details as requested. This seems to be a use case for Simple XML JS extension where you would color based on current hour and count returned by the query. Please confirm!

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

Goldbeed
Engager

I couldent figure out a way to edit the colors in the search but you can in the dashboards. I don't think you can in search.

Search:
| sort - time | eval VioletTimes>1.5sec = if (time>1.5,time ,0) | eval RedTimes>1sec = if(time <=1.5 AND time >1,time ,0) | eval OrangeTimes>750ms = if(time <=1 AND time >0.75,time ,0) | eval .YellowTimes>500ms = if(time <=0.75 AND time >0.5,time ,0) | eval .NormalTimes<500ms = if(time <=0.5, time , 0) | fields - time

XML edit on dashboard
{"VioletTimes>1.5sec":0x8B2252, "RedTimes>1sec":0xFF0000, "OrangeTimes>750ms":0xFFA500, ".YellowTimes>500ms":0xFFFF00, ".NormalTimes<500ms":0x73A550}

0 Karma
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...