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>
---
What goes around comes around. If it helps, hit it with Karma 🙂

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>
---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...