Dashboards & Visualizations

How can I apply color over the cells having special character in values?

mnj1809
Path Finder

Hello,

I've a tabular data like below and I want to color the cells based on the following threshold.
0%-79% ==> Red
80%-99% ==> Yellow
100% ==> Green

mnj1809_0-1683038549693.png

I am applying below but without any success. I know that this is due to % symbol in the values.

<format type="color" field="Passed Rules">
<colorPalette type="list">[#FF9999,#FFE699,#C6E0B4]</colorPalette>
<scale type="threshold">80%,100%</scale>
</format>

So how can I apply colors over the cell?

Thanks in advance.

@ITWhisperer 

Labels (3)
0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

You can't use range expressions if your data is not numeric and the % sign breaks them, so you have to use an expression. Use this

<format type="color" field="Passed Rules">
  <colorPalette type="expression">case(tonumber(rtrim(value, "%"))>=100, "#C6E0B4",tonumber(rtrim(value, "%"))>80, "#FFE699",true(), "#FF9999")
  </colorPalette>
</format>

which effectively removes the % to calculate each range in the expression.

View solution in original post

0 Karma

bowesmana
SplunkTrust
SplunkTrust

You can't use range expressions if your data is not numeric and the % sign breaks them, so you have to use an expression. Use this

<format type="color" field="Passed Rules">
  <colorPalette type="expression">case(tonumber(rtrim(value, "%"))>=100, "#C6E0B4",tonumber(rtrim(value, "%"))>80, "#FFE699",true(), "#FF9999")
  </colorPalette>
</format>

which effectively removes the % to calculate each range in the expression.

0 Karma

mnj1809
Path Finder

Perfect !!!
Thank you so much @bowesmana 

0 Karma
Get Updates on the Splunk Community!

Build Scalable Security While Moving to Cloud - Guide From Clayton Homes

 Clayton Homes faced the increased challenge of strengthening their security posture as they went through ...

Mission Control | Explore the latest release of Splunk Mission Control (2.3)

We’re happy to announce the release of Mission Control 2.3 which includes several new and exciting features ...

Cloud Platform | Migrating your Splunk Cloud deployment to Python 3.7

Python 2.7, the last release of Python 2, reached End of Life back on January 1, 2020. As part of our larger ...