<?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 Dynamically Change panel background color based on returned value (no js possible) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Dynamically-Change-panel-background-color-based-on-returned/m-p/560659#M159338</link>
    <description>&lt;P&gt;Hi.&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, I've been using this forum for a few months now as I'm new to Splunk.&amp;nbsp; &amp;nbsp;Thanks to all the contributors on here!!&lt;/P&gt;&lt;P&gt;So here's what I'm trying to figure out.&amp;nbsp; &amp;nbsp;I have a dashboard with 3 line charts.&amp;nbsp; Each line chart is in it's own unique panel (each panel has it's own unique Id).&amp;nbsp; I'd like to change the panel background when a returned query value is above a certain number but green when below that number.&lt;/P&gt;&lt;P&gt;This is the sample code I'm using to hardcode the 3 panels to either red or green.&lt;/P&gt;&lt;P&gt;&amp;lt;row&amp;gt;&lt;BR /&gt;&amp;lt;panel&amp;gt;&lt;BR /&gt;&amp;lt;html&amp;gt;&lt;BR /&gt;&amp;lt;style&amp;gt;&lt;BR /&gt;#A .dashboard-panel {&lt;BR /&gt;background: #5AAF71 !important;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;#B .dashboard-panel {&lt;BR /&gt;background: #E35033 !important;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;#C .dashboard-panel {&lt;BR /&gt;background: #5AAF71 !important;&lt;BR /&gt;}&lt;BR /&gt;&amp;lt;/style&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/html&amp;gt;&lt;BR /&gt;&amp;lt;/panel&amp;gt;&lt;BR /&gt;&amp;lt;/row&amp;gt;&lt;/P&gt;&lt;P&gt;But I'm looking for a way to dynamically change the panel background colors based on the query returning value.&lt;/P&gt;&lt;P&gt;Also, I am not an admin and we don't have permissions to load javascript / CSS files so all of my coding will have to be set into the Dashboard XML.&lt;/P&gt;&lt;P&gt;I have used the range before to change colors in the Singles.&amp;nbsp; Just not sure if it's possible with a panel background that the line chart sits in.&lt;/P&gt;&lt;P&gt;thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 23 Jul 2021 21:21:35 GMT</pubDate>
    <dc:creator>AdrianH</dc:creator>
    <dc:date>2021-07-23T21:21:35Z</dc:date>
    <item>
      <title>Dynamically Change panel background color based on returned value (no js possible)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamically-Change-panel-background-color-based-on-returned/m-p/560659#M159338</link>
      <description>&lt;P&gt;Hi.&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, I've been using this forum for a few months now as I'm new to Splunk.&amp;nbsp; &amp;nbsp;Thanks to all the contributors on here!!&lt;/P&gt;&lt;P&gt;So here's what I'm trying to figure out.&amp;nbsp; &amp;nbsp;I have a dashboard with 3 line charts.&amp;nbsp; Each line chart is in it's own unique panel (each panel has it's own unique Id).&amp;nbsp; I'd like to change the panel background when a returned query value is above a certain number but green when below that number.&lt;/P&gt;&lt;P&gt;This is the sample code I'm using to hardcode the 3 panels to either red or green.&lt;/P&gt;&lt;P&gt;&amp;lt;row&amp;gt;&lt;BR /&gt;&amp;lt;panel&amp;gt;&lt;BR /&gt;&amp;lt;html&amp;gt;&lt;BR /&gt;&amp;lt;style&amp;gt;&lt;BR /&gt;#A .dashboard-panel {&lt;BR /&gt;background: #5AAF71 !important;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;#B .dashboard-panel {&lt;BR /&gt;background: #E35033 !important;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;#C .dashboard-panel {&lt;BR /&gt;background: #5AAF71 !important;&lt;BR /&gt;}&lt;BR /&gt;&amp;lt;/style&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/html&amp;gt;&lt;BR /&gt;&amp;lt;/panel&amp;gt;&lt;BR /&gt;&amp;lt;/row&amp;gt;&lt;/P&gt;&lt;P&gt;But I'm looking for a way to dynamically change the panel background colors based on the query returning value.&lt;/P&gt;&lt;P&gt;Also, I am not an admin and we don't have permissions to load javascript / CSS files so all of my coding will have to be set into the Dashboard XML.&lt;/P&gt;&lt;P&gt;I have used the range before to change colors in the Singles.&amp;nbsp; Just not sure if it's possible with a panel background that the line chart sits in.&lt;/P&gt;&lt;P&gt;thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2021 21:21:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamically-Change-panel-background-color-based-on-returned/m-p/560659#M159338</guid>
      <dc:creator>AdrianH</dc:creator>
      <dc:date>2021-07-23T21:21:35Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Change panel background color based on returned value (no js possible)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamically-Change-panel-background-color-based-on-returned/m-p/560664#M159341</link>
      <description>&lt;P&gt;You can use token in the CSS stylesheet&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;          #A .dashboard-element-header {
            background: $backgroundcolour$ !important;
          }&lt;/LI-CODE&gt;&lt;P&gt;which you could set in the done handler of the search&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;          &amp;lt;done&amp;gt;
            &amp;lt;set token="backgroundcolour"&amp;gt;green&amp;lt;/set&amp;gt;
          &amp;lt;/done&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 23 Jul 2021 23:10:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamically-Change-panel-background-color-based-on-returned/m-p/560664#M159341</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-07-23T23:10:58Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Change panel background color based on returned value (no js possible)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamically-Change-panel-background-color-based-on-returned/m-p/560676#M159348</link>
      <description>&lt;P&gt;I've been playing around with this since last night but no luck.&amp;nbsp; The concept of event handling is making more sense based on your suggestion + reading more about them last night.&lt;/P&gt;&lt;P&gt;But I'm still not able to get this working.&amp;nbsp; And I'm guessing it's because I need a condition tag?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So Instead of this in the &amp;lt;search&amp;gt;:&lt;BR /&gt;&amp;lt;done&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;set token="backgroundcolour"&amp;gt;green&amp;lt;/set&amp;gt;&lt;BR /&gt;&amp;lt;/done&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To set the background to red if value &amp;gt; 80, else default to green, then maybe something like this added to the search tag?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;lt;done&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;condition match="result.AvgMemUsed&amp;gt;80"&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;set token="backgroundcolour"&amp;gt;red&amp;lt;/set&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/condition&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;condition&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;set token="backgroundcolour"&amp;gt;green&amp;lt;/set&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/condition&amp;gt;&lt;BR /&gt;&amp;lt;/done&amp;gt;&lt;/P&gt;&lt;P&gt;Where the 2nd condition (if i'm understanding the syntax is right) is the default if the other condition is not true.&lt;/P&gt;&lt;P&gt;I've been trying the 2nd solution (as well as many other things) but no luck so far.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Jul 2021 14:25:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamically-Change-panel-background-color-based-on-returned/m-p/560676#M159348</guid>
      <dc:creator>AdrianH</dc:creator>
      <dc:date>2021-07-24T14:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Change panel background color based on returned value (no js possible)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamically-Change-panel-background-color-based-on-returned/m-p/560677#M159349</link>
      <description>&lt;P&gt;You need to put the field name in single quotes and you have to encode the greater than sign&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; &amp;lt;done&amp;gt;
        &amp;lt;condition match="'result.AvgMemUsed'&amp;amp;gt;80"&amp;gt;
                &amp;lt;set token="backgroundcolour"&amp;gt;red&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
        &amp;lt;condition&amp;gt;
                &amp;lt;set token="backgroundcolour"&amp;gt;green&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
&amp;lt;/done&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 24 Jul 2021 14:58:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamically-Change-panel-background-color-based-on-returned/m-p/560677#M159349</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-07-24T14:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Change panel background color based on returned value (no js possible)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamically-Change-panel-background-color-based-on-returned/m-p/560693#M159360</link>
      <description>&lt;P&gt;That worked!!&amp;nbsp; &amp;nbsp; Thank you very much, sir!&lt;/P&gt;</description>
      <pubDate>Sat, 24 Jul 2021 22:58:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamically-Change-panel-background-color-based-on-returned/m-p/560693#M159360</guid>
      <dc:creator>AdrianH</dc:creator>
      <dc:date>2021-07-24T22:58:23Z</dc:date>
    </item>
  </channel>
</rss>

