Dashboards & Visualizations

How to add multiple conditions and the respective color coding for all the fields?

akarivaratharaj
Communicator

I have my table panel with the column field as Month-year and this is a dynamic fields populated from my panel query. One more column is a text field and it is a static field. (This does not need to be color coded.)

I want to color code the cell values in all the dynamic field, based on the below condition

  • if the cell value is less than 2 - the cell should be coded in green
  • if the cell value is more than 2 - the cell should be coded in red.
  • Other cells with text values - the cell should not be color coded.

I tried to use multiple conditions with color palatte expression but that does not work

<format type="color">
          <colorPalette type="expression">if(isnull(value), "#c1fa9b", if(value&lt;02, "#c1fa9b", "#ff9c9c"), if(value&gt;02, "#ff9c9c", "#c1fa9b"))</colorPalette>
        </format>

 

I did the two conditions similar, just to filter the fields with text values. So that all the numeric fields with values less than 2 will be displayed as green and the greater than 2 will be displayed as red.

I am aware of writing JS scripts for this but would like to make this with SimpleXML.

Could anyone please help me on this?

Labels (1)
Tags (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

By the way, you conditions do not take account of the value being 2

        <format type="color">
          <colorPalette type="expression">case(isnull(value),"#c1fa9b", value &lt; 02, "#c1fa9b", value &gt; 02, "#ff9c9c")</colorPalette>
        </format>

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

By the way, you conditions do not take account of the value being 2

        <format type="color">
          <colorPalette type="expression">case(isnull(value),"#c1fa9b", value &lt; 02, "#c1fa9b", value &gt; 02, "#ff9c9c")</colorPalette>
        </format>
0 Karma

akarivaratharaj
Communicator

Thankyou! 

The code with case statement is working for me. To consider the value '2' also, I can use 

value &lt;= 02

 

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...