Dashboards & Visualizations

How to change colors of column chart output?

jpurnhag
Explorer

I can't seem to figure this out. I've read every thread on here as well as Splunk docs relating to this. The spl output looks like I want it to, but on a dashboard everything is blue. I've added fieldColors to my source, but still can't get it to work. What am I missing? Attachment provided.

 

 

index=health_checks dev=false
| stats avg(eval(round(uptime_minutes*100,0))) as uptime, avg(eval(round(month_minutes*100,0))) as month, by customer
| eval score=round(uptime/month*100,0)
| eval range=case(score < 75, "severely degraded", score >= 75 AND score < 95, "slightly degraded", score >= 95, "healthy")
| stats count(score) as stacks by range

 

 

 

 

 

<option name="charting.fieldColors">{"healthy": 0x008000, "slightly degraded": 0xFFFF00, "severely degraded": 0xFF0000, "NULL": 0xC4C4C0}</option>

 

 

 

Labels (3)
0 Karma

jpurnhag
Explorer

@somesoni2 This is how the output should look, but doing it this way will not show the three colors on the panel, and I've been unable to figure it out. Any ideas?

0 Karma

jpurnhag
Explorer

We're getting there! That gives me the colors on the panel, but the visual is out-of-whack. This is what it looks like on the panel as well. Is my structure poorly defined?

0 Karma

somesoni2
Revered Legend

Use this query and in the visualization, select "Stack Mode" to "stacked" (middle option).

0 Karma

jpurnhag
Explorer

Thank you, @somesoni2 . Please see attachment. I copied/pasted your edits and got a group-by error, so I changed "by stacks range" to "by range", which gave me the same query results, but no change on the panel; columns are still blue. I removed the "NULL" reference as I got that from another thread but I don't need it.

0 Karma

somesoni2
Revered Legend

My bad. I just updated the query., try that. 

That parser error was due to using same name in aggregated field in stats as in the by clause of the stats.

0 Karma

somesoni2
Revered Legend

Your charting.fieldColors expects fields with name “healthy”, slightly degraded”, “severely degraded” and “NULL” to be present in the search result. Your search gives fields “range” and “stacks” hence it fails. Try this workaround. 

**Updated

 

index=health_checks dev=false
| stats avg(eval(round(uptime_minutes*100,0))) as uptime, avg(eval(round(month_minutes*100,0))) as month, by customer
| eval score=round(uptime/month*100,0)
| eval range=case(score < 75, "severely degraded", score >= 75 AND score < 95, "slightly degraded", score >= 95, "healthy")
| eval stacks=range 
| chart count(score) by stacks range

 

 

0 Karma

jpurnhag
Explorer

@somesoni2 I feel like this isn't right. See screenshots . The colors show up on the dashboard panel, but the bars are not centered on the x-axis, and the query output looks like it's wrong; like it's trying to chart zeros. Any thoughts? The table in the output seems unnecessarily redundant?

Screen Shot 2022-03-03 at 12.41.22 PM.png

0 Karma

jpurnhag
Explorer

I'm getting the colors I want now, but is the output of the query expected to look like this?

Screen Shot 2022-03-01 at 3.29.31 PM.png

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...