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!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...