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!

Prove Your Splunk Prowess at .conf25—No Prereqs Required!

Your Next Big Security Credential: No Prerequisites Needed We know you’ve got the skills, and now, earning the ...

Splunk Observability Cloud's AI Assistant in Action Series: Observability as Code

This is the sixth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...

Splunk Answers Content Calendar, July Edition I

Hello Community! Welcome to another month of Community Content Calendar series! For the month of July, we will ...