Dashboards & Visualizations

Changing the color of the number in dashboard that have a string attached

phamxuantung
Communicator

To be specific, I have a dashboard panel that show percentage of timed out transaction, and I want it to change color to alert red when it reach 20% or more. When I use the Edit dashboard/Format visualization/Color, it can only change if the showed result is number, because my result is a number, with a "%" attached to it, it have no effect, here is my code

 

|eval Timed_Out =round((Timed/Total)*100,2)."%"
|table Timed_Out

 

So is there a way for the showed result automatically have "%" so the Format Visualization could work?

Thank you

Labels (1)
0 Karma
1 Solution

renjith_nair
Legend

You may use the format number option in the visualization

        <format type="number" field="perc">
          <option name="unit">%</option>
        </format>

Here is a run anywhere example

<form>
  <label>Colors</label>
  <fieldset submitButton="false">
    <input type="text" token="perc">
      <label>Input Percentage</label>
      <default>20</default>
      <initialValue>20</initialValue>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <search>
          <query>|makeresults|eval Percentage=$perc$</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
        <option name="refresh.display">progressbar</option>
        <format type="color" field="perc">
          <colorPalette type="list">[#53A051,#006D9C,#F8BE34,#F1813F,#DC4E41]</colorPalette>
          <scale type="threshold">0,30,70,100</scale>
        </format>
        <format type="number" field="perc">
          <option name="unit">%</option>
        </format>
        <format type="color" field="Percentage">
          <colorPalette type="list">[#DC4E41,#F1813F,#F8BE34,#53A051]</colorPalette>
          <scale type="threshold">20,40,60</scale>
        </format>
        <format type="number" field="Percentage">
          <option name="unit">%</option>
        </format>
      </table>
    </panel>
    <panel>
      <single>
        <search>
          <query>|makeresults|eval Percentage=$perc$</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
        </search>
        <option name="colorMode">none</option>
        <option name="drilldown">none</option>
        <option name="rangeColors">["0xdc4e41","0xdc4e41","0xf8be34","0xf1813f","0x53a051"]</option>
        <option name="rangeValues">[0,20,40,60]</option>
        <option name="refresh.display">progressbar</option>
        <option name="unit">%</option>
        <option name="useColors">1</option>
      </single>
    </panel>
  </row>
</form>
Happy Splunking!

View solution in original post

0 Karma

renjith_nair
Legend

You may use the format number option in the visualization

        <format type="number" field="perc">
          <option name="unit">%</option>
        </format>

Here is a run anywhere example

<form>
  <label>Colors</label>
  <fieldset submitButton="false">
    <input type="text" token="perc">
      <label>Input Percentage</label>
      <default>20</default>
      <initialValue>20</initialValue>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <search>
          <query>|makeresults|eval Percentage=$perc$</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
        <option name="refresh.display">progressbar</option>
        <format type="color" field="perc">
          <colorPalette type="list">[#53A051,#006D9C,#F8BE34,#F1813F,#DC4E41]</colorPalette>
          <scale type="threshold">0,30,70,100</scale>
        </format>
        <format type="number" field="perc">
          <option name="unit">%</option>
        </format>
        <format type="color" field="Percentage">
          <colorPalette type="list">[#DC4E41,#F1813F,#F8BE34,#53A051]</colorPalette>
          <scale type="threshold">20,40,60</scale>
        </format>
        <format type="number" field="Percentage">
          <option name="unit">%</option>
        </format>
      </table>
    </panel>
    <panel>
      <single>
        <search>
          <query>|makeresults|eval Percentage=$perc$</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
        </search>
        <option name="colorMode">none</option>
        <option name="drilldown">none</option>
        <option name="rangeColors">["0xdc4e41","0xdc4e41","0xf8be34","0xf1813f","0x53a051"]</option>
        <option name="rangeValues">[0,20,40,60]</option>
        <option name="refresh.display">progressbar</option>
        <option name="unit">%</option>
        <option name="useColors">1</option>
      </single>
    </panel>
  </row>
</form>
Happy Splunking!
0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...