Dashboards & Visualizations

How to add color in a column based on other columns using conditions?

niks987
Explorer

Hi All,

I have created a table using stats command which displays store number, avgCPU, avg IOWAIT, avgRAM. For the avgCPU, avg IOWAIT and avgRAM i have given color based on the thresholds using the color bar from edit section(the paint brush symbol). I was trying to change the color of the Store Name cells based on the color in other cells i.e. if the color of any cell is red, Store Name cell should be red, if color of any cell is amber, Store Name cell should be in amber and if all the cells are green then the Store Name cell should be green. I cannot use js as i don't have access to config files . Is there any other was that i can use like condition maybe?

Tags (1)
1 Solution

DavidHourani
Super Champion

Hi @niks987,

Did you check out this documentation, you should be able to configure conditional formating from xml :
https://docs.splunk.com/Documentation/Splunk/7.2.6/Viz/TableFormatsXML#Color_format_rules
for example :

   <colorPalette type="expression">if (value == "splunkd", "#65A637", "#0000CC")
    </colorPalette>

Cheers,
David

View solution in original post

DavidHourani
Super Champion

Hi @niks987,

Did you check out this documentation, you should be able to configure conditional formating from xml :
https://docs.splunk.com/Documentation/Splunk/7.2.6/Viz/TableFormatsXML#Color_format_rules
for example :

   <colorPalette type="expression">if (value == "splunkd", "#65A637", "#0000CC")
    </colorPalette>

Cheers,
David

dmarling
Builder

I believe @niketnilay may have answered this question under this answer: https://answers.splunk.com/answers/716558/add-colors-to-a-table-for-dynamic-columns.html#comment-716...

If this comment/answer was helpful, please up vote it. Thank you.
0 Karma

niks987
Explorer

HI Damarling,

Thanks for replying.

Yes i have seen that, but i wanted to ask is there any other way to do it without using j query or js.
I have been trying to edit the XML file like changing the format section or doing changes using the brush option.

   <format type="color" field="Store Number">
      <colorPalette type="map">{"80":#F1813F,"90":#DC4E41}</colorPalette>
    </format>

Something like this, i know this wont work, its just an example.

Thanks for your help.

0 Karma
Get Updates on the Splunk Community!

Splunk Observability Cloud’s AI Assistant in Action Series: Analyzing and ...

This is the second post in our Splunk Observability Cloud’s AI Assistant in Action series, in which we look at ...

Elevate Your Organization with Splunk’s Next Platform Evolution

 Thursday, July 10, 2025  |  11AM PDT / 2PM EDT Whether you're managing complex deployments or looking to ...

Splunk Answers Content Calendar, June Edition

Get ready for this week’s post dedicated to Splunk Dashboards! We're celebrating the power of community by ...