<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to add background colour to single value visualisation based on the value returned by the query? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-add-background-colour-to-single-value-visualisation-based/m-p/616744#M50637</link>
    <description>&lt;P&gt;It worked&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;. Thanks a lot!&lt;/P&gt;</description>
    <pubDate>Tue, 11 Oct 2022 22:09:51 GMT</pubDate>
    <dc:creator>ktanwar</dc:creator>
    <dc:date>2022-10-11T22:09:51Z</dc:date>
    <item>
      <title>How to add background colour to single value visualisation based on the value returned by the query?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-add-background-colour-to-single-value-visualisation-based/m-p/616565#M50626</link>
      <description>&lt;P&gt;Hi all, I have just started using Splunk dashboards to visualise my data, sorry for asking such a simple question. I have added single value panel on my dashboard which shows the verdict of the test performed. I am using the following the source code:&lt;BR /&gt;```&lt;/P&gt;
&lt;P&gt;&amp;lt;row&amp;gt;&lt;BR /&gt;&amp;lt;panel&amp;gt;&lt;BR /&gt;&amp;lt;single&amp;gt;&lt;BR /&gt;&amp;lt;title&amp;gt;Verdict&amp;lt;/title&amp;gt;&lt;BR /&gt;&amp;lt;search&amp;gt;&lt;BR /&gt;&amp;lt;query&amp;gt;index=test_index&lt;BR /&gt;| search splunk_id="$splunk_id$"&lt;BR /&gt;| table verdict&lt;BR /&gt;&amp;lt;/query&amp;gt;&lt;BR /&gt;&amp;lt;/search&amp;gt;&lt;BR /&gt;&amp;lt;option name="colorMode"&amp;gt;block&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option name="height"&amp;gt;60&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option name="rangeColors"&amp;gt;["0x53a051","0x0877a6","0xf8be34","0xf1813f","0xdc4e41"]&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option name="useColors"&amp;gt;1&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;/single&amp;gt;&lt;BR /&gt;&amp;lt;/panel&amp;gt;&lt;BR /&gt;&amp;lt;/row&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;```&lt;/P&gt;
&lt;P&gt;It creates a panel with black background colour with text in white colour at the centre. So verdict will give only 2 values ('Pass' or 'Fail'). What I want is the panel should have green background colour is verdict is 'Pass' and red colour background if verdict is 'Fail'. Along with this I would like to have 'Pass' and 'Fail' written in black colour rather than white colour.&lt;BR /&gt;I am not the admin of the Splunk server so I cant add and javascript file or css file to the source code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help would be hugely appreciated. Thanks!&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp;can you help me out here if you can? Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 19:33:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-add-background-colour-to-single-value-visualisation-based/m-p/616565#M50626</guid>
      <dc:creator>ktanwar</dc:creator>
      <dc:date>2022-10-10T19:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to add background colour to single value visualisation based on the value returned by the query?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-add-background-colour-to-single-value-visualisation-based/m-p/616586#M50629</link>
      <description>&lt;P&gt;You can use either of these two methods - the first panel uses CSS to control the colours for the foreground (text) and block background. The search sets tokens based on the value of the verdict.&lt;/P&gt;&lt;P&gt;The second panel uses the additional 'range' field to define range as low or severe depending on the verdict value.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;tst&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel depends="$hide_css$"&amp;gt;
      &amp;lt;html&amp;gt;
        &amp;lt;style&amp;gt;
          #verdict rect {
            fill: $verdict_background$ !important;
          }
          #verdict text {
            fill: $verdict_foreground$ !important;
          }
        &amp;lt;/style&amp;gt;
      &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;single id="verdict"&amp;gt;
        &amp;lt;title&amp;gt;Verdict&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults
          | eval verdict=mvindex(split("Pass,Fail",","), random() % 2)
          &amp;lt;/query&amp;gt;
          &amp;lt;done&amp;gt;
            &amp;lt;eval token="verdict_background"&amp;gt;if($result.verdict$="Pass", "green", "red")&amp;lt;/eval&amp;gt;
            &amp;lt;set token="verdict_foreground"&amp;gt;black&amp;lt;/set&amp;gt;
          &amp;lt;/done&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="colorMode"&amp;gt;block&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="height"&amp;gt;60&amp;lt;/option&amp;gt;
        &amp;lt;option name="rangeColors"&amp;gt;["0x53a051","0xdc4e41"]&amp;lt;/option&amp;gt;
        &amp;lt;option name="rangeValues"&amp;gt;[0]&amp;lt;/option&amp;gt;
        &amp;lt;option name="useColors"&amp;gt;1&amp;lt;/option&amp;gt;
      &amp;lt;/single&amp;gt;
    &amp;lt;/panel&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;single&amp;gt;
        &amp;lt;title&amp;gt;Verdict 2&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults
          | eval verdict=mvindex(split("Pass,Fail",","), random() % 2)
          | eval range=if(verdict=="Pass", "low", "severe")
          | table verdict range
          &amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="colorMode"&amp;gt;block&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="height"&amp;gt;60&amp;lt;/option&amp;gt;
        &amp;lt;option name="field"&amp;gt;verdict&amp;lt;/option&amp;gt;
      &amp;lt;/single&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2022 00:13:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-add-background-colour-to-single-value-visualisation-based/m-p/616586#M50629</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2022-10-11T00:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to add background colour to single value visualisation based on the value returned by the query?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-add-background-colour-to-single-value-visualisation-based/m-p/616744#M50637</link>
      <description>&lt;P&gt;It worked&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;. Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2022 22:09:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-add-background-colour-to-single-value-visualisation-based/m-p/616744#M50637</guid>
      <dc:creator>ktanwar</dc:creator>
      <dc:date>2022-10-11T22:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to add background colour to single value visualisation based on the value returned by the query?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-add-background-colour-to-single-value-visualisation-based/m-p/616747#M50638</link>
      <description>&lt;P&gt;Just 1 pie chart related question &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp;, asking it here just for ease of use.&lt;/P&gt;&lt;P&gt;I have a piechart created by following code:&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;&amp;lt;panel&amp;gt;&lt;BR /&gt;&amp;lt;chart&amp;gt;&lt;BR /&gt;&amp;lt;search&amp;gt;&lt;BR /&gt;&amp;lt;query&amp;gt;&lt;BR /&gt;index=test_index&lt;BR /&gt;| search splunk_id="$splunk_id$"&lt;BR /&gt;| table campaign_data.All.total_passed campaign_data.All.total_failed campaign_data.All.total_not_run&lt;BR /&gt;| rename campaign_data.All.total_passed as "Passed" campaign_data.All.total_failed as "Failed" campaign_data.All.total_not_run as "Not Run"&lt;BR /&gt;| eval name="No of Tests"&lt;BR /&gt;| transpose 0 header_field=name&lt;BR /&gt;&amp;lt;/query&amp;gt;&lt;BR /&gt;&amp;lt;/search&amp;gt;&lt;BR /&gt;&amp;lt;option name="charting.chart"&amp;gt;pie&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option name="charting.drilldown"&amp;gt;none&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option name="charting.fieldColors"&amp;gt;{"Failed": 0xFF0000, "Not Run": 0x808080, "Passed":0x009900, "NULL":0xC4C4C0}&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;/chart&amp;gt;&lt;BR /&gt;&amp;lt;/panel&amp;gt;&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;it gives the following output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ktanwar_1-1665526409554.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21975i7D87C065FDD67754/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ktanwar_1-1665526409554.png" alt="ktanwar_1-1665526409554.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When 1 hover over a part it shows 3 rows of data. What I want is in the 3rd row, the percentage should be cutoff by 2 decimal pts. Also can we change the label "No of tests%" to "Percentage" but keep 2nd row data value as it is? Is it possible? Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2022 22:16:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-add-background-colour-to-single-value-visualisation-based/m-p/616747#M50638</guid>
      <dc:creator>ktanwar</dc:creator>
      <dc:date>2022-10-11T22:16:09Z</dc:date>
    </item>
  </channel>
</rss>

