<?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: Change chart bar color based on data value? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56686#M3000</link>
    <description>&lt;P&gt;I edited my answer for typos, and now it seems to have gone to be "moderated." Hopefully the accepted answer will return soon!&lt;/P&gt;</description>
    <pubDate>Fri, 26 Jun 2015 06:33:53 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2015-06-26T06:33:53Z</dc:date>
    <item>
      <title>Change chart bar color based on data value?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56685#M2999</link>
      <description>&lt;P&gt;I have a bar chart that represents a key metric for my SLA. Let's say that each bar represents 1 server, and the height (value) of the bar is the number of a certain server error.  The SLA says that we can't have more than 20 errors per server.&lt;/P&gt;

&lt;P&gt;Currently, my search looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mysourcetype AND searchstuffforerrors | stats count by host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and the bars are all blue. I would like for the bar to change colors:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;green when the number of errors is less than 15&lt;/LI&gt;
&lt;LI&gt;yellow when the number of errors is 16 - 20&lt;/LI&gt;
&lt;LI&gt;red when the number of errors is greater than 20&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;I can't use a single value panel or a gauge for this, as I need to show &lt;EM&gt;all&lt;/EM&gt; the servers - one bar for each server. How can I do this with Splunk?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2012 08:53:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56685#M2999</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-09-11T08:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: Change chart bar color based on data value?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56686#M3000</link>
      <description>&lt;P&gt;I edited my answer for typos, and now it seems to have gone to be "moderated." Hopefully the accepted answer will return soon!&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jun 2015 06:33:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56686#M3000</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2015-06-26T06:33:53Z</dc:date>
    </item>
    <item>
      <title>Re: Change chart bar color based on data value?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56687#M3001</link>
      <description>&lt;P&gt;If you are  using a saved search, your saved search should include the eval statements, like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mysourcetype AND searchstuffforerrors | stats count by host 
| eval redCount = if(count&amp;gt;20,count,0)
| eval yellowCount = if(count&amp;lt;=20 AND count&amp;gt;15,count,0)
| eval greenCount = if(count&amp;lt;=15, count, 0)
| fields - count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And then the XML would be (if you named your search MySearch)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;chart&amp;gt;
      &amp;lt;searchName&amp;gt;MySearch&amp;lt;/searchName&amp;gt;
      &amp;lt;title&amp;gt;Server Errors by Host - Last  24 hours&amp;lt;/title&amp;gt;
      &amp;lt;option name="charting.chart"&amp;gt;column&amp;lt;/option&amp;gt;
      &amp;lt;option name="charting.chart.stackMode"&amp;gt;stacked&amp;lt;/option&amp;gt;
      &amp;lt;option name="charting.fieldColors"&amp;gt;{"redCount":0xFF0000,"yellowCount":0xFFFF00, "greenCount":0x73A550}&amp;lt;/option&amp;gt;
      &amp;lt;option name="charting.legend.placement"&amp;gt;none&amp;lt;/option&amp;gt;
      &amp;lt;option name="charting.legend.placement"&amp;gt;none&amp;lt;/option&amp;gt;     
      &amp;lt;option name="charting.axisLabelsX.majorLabelStyle.rotation"&amp;gt;90&amp;lt;/option&amp;gt;  
    &amp;lt;/chart&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Jun 2015 07:20:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56687#M3001</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2015-06-26T07:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: Change chart bar color based on data value?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56688#M3002</link>
      <description>&lt;P&gt;Here is how&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Create a new variable for each color of bar that you want: redCount, yellowCount, greenCount - for example&lt;/LI&gt;
&lt;LI&gt;Assign the count value to the appropriate variable&lt;/LI&gt;
&lt;LI&gt;Create a stacked column chart (or a stacked bar chart if you want it horizontally)&lt;/LI&gt;
&lt;LI&gt;Put the chart in a dashboard, so that you can set the color attributes for the bars&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Here is a simple XML example of the code snippet for a chart that should work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;chart&amp;gt;
      &amp;lt;searchString&amp;gt;sourcetype=mysourcetype AND searchstuffforerrors | stats count by host 
        | eval redCount = if(count&amp;gt;20,count,0)
        | eval yellowCount = if(count&amp;lt;=20 AND count&amp;gt;15,count,0)
        | eval greenCount = if(count&amp;lt;=15, count, 0)
        | fields - count&amp;lt;/searchString&amp;gt;
      &amp;lt;title&amp;gt;Server Errors by Host - Last  24 hours&amp;lt;/title&amp;gt;
      &amp;lt;earliestTime&amp;gt;-24h@h&amp;lt;/earliestTime&amp;gt;
      &amp;lt;latestTime&amp;gt;@h&amp;lt;/latestTime&amp;gt;
      &amp;lt;option name="charting.chart"&amp;gt;column&amp;lt;/option&amp;gt;
      &amp;lt;option name="charting.chart.stackMode"&amp;gt;stacked&amp;lt;/option&amp;gt;
      &amp;lt;option name="charting.fieldColors"&amp;gt;{"redCount":0xFF0000,"yellowCount":0xFFFF00, "greenCount":0x73A550}&amp;lt;/option&amp;gt;
      &amp;lt;option name="charting.legend.placement"&amp;gt;none&amp;lt;/option&amp;gt;
      &amp;lt;option name="charting.legend.placement"&amp;gt;none&amp;lt;/option&amp;gt;     
      &amp;lt;option name="charting.axisLabelsX.majorLabelStyle.rotation"&amp;gt;90&amp;lt;/option&amp;gt;  
    &amp;lt;/chart&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note that the last option sets the X-axis labels to print vertically on the column chart. If you prefer, you could set the charting.chart option to "bar" and then eliminate the option for charting.axisLabelsX.majorLabelStyle.rotation&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jun 2015 07:20:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56688#M3002</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2015-06-26T07:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: Change chart bar color based on data value?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56689#M3003</link>
      <description>&lt;P&gt;How to change the colour of chart if it is a saved search ?&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jun 2015 07:20:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56689#M3003</guid>
      <dc:creator>aneeshkjm123</dc:creator>
      <dc:date>2015-06-26T07:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: Change chart bar color based on data value?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56690#M3004</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;tag="BOFC" OR tag="Compass_Asia" OR tag="Compass_Global" OR tag="Datapass_CCNA" OR tag="Datapass_CPS" OR tag="IPM" OR tag="Picasso" OR tag="SAP_APO" OR tag="SAP_CRM_Call_Center" OR tag="SAP_Finance_Logistics" OR tag="SAP_HR" OR tag="SAP_MDMaint" OR tag="SAP_MDMgmt" OR tag="SAP_SRM" OR tag="SAP_eSourcing" OR    tag="SDW" OR tag="Wall_Street" OR tag="myKO_Portal" OR tag="myKO_UCM" LocID="-7" SbuID="-7" |dedup tag | rex field=ResponseDisplay "(?&amp;lt;Application_Response&amp;gt;\d+)" |rex field=AvailabilityDisplay "(?&amp;lt;Application_Availability&amp;gt;\d+)" |eval x=tonumber(Application_Availability) |eval y=tonumber(Application_Response) |stats values(x) values(y) by tag
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;x and y are values between 0 and 100. I want x and y values between 0 and 50 to be red, 51 and 75 to be yellow and 76-100 to be green. Please help!&lt;/P&gt;</description>
      <pubDate>Sun, 12 Jul 2015 04:07:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56690#M3004</guid>
      <dc:creator>zd00191</dc:creator>
      <dc:date>2015-07-12T04:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: Change chart bar color based on data value?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56691#M3005</link>
      <description>&lt;P&gt;This is a completely different problem - you should ask this as a question...&lt;/P&gt;</description>
      <pubDate>Sat, 12 Dec 2015 17:17:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56691#M3005</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2015-12-12T17:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: Change chart bar color based on data value?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56692#M3006</link>
      <description>&lt;P&gt;sourcetype=mysourcetype AND searchstuffforerrors | stats count by host &lt;BR /&gt;
 | eval redCount = if(count&amp;gt;20,count,0)&lt;BR /&gt;
 | eval yellowCount = if(count&amp;lt;=20 AND count&amp;gt;15,count,0)&lt;BR /&gt;
 | eval greenCount = if(count&amp;lt;=15, count, 0)&lt;BR /&gt;
 | fields - count&lt;/P&gt;

&lt;P&gt;How to make it to count only top 10 values?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2016 07:15:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56692#M3006</guid>
      <dc:creator>a1ay</dc:creator>
      <dc:date>2016-06-23T07:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: Change chart bar color based on data value?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56693#M3007</link>
      <description>&lt;P&gt;Add the following at the ending:-&lt;BR /&gt;
|top count&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2016 11:24:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56693#M3007</guid>
      <dc:creator>email2vamsi</dc:creator>
      <dc:date>2016-11-24T11:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: Change chart bar color based on data value?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56694#M3008</link>
      <description>&lt;P&gt;I had a similar requirement and it worked fine for me, but the each bar falls in one of three color segments, the other segments have zero value that leads to blank spaces in the Time chart&lt;BR /&gt;
Is there a way to remove the blank spaces?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 16:59:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56694#M3008</guid>
      <dc:creator>hwakonwalk</dc:creator>
      <dc:date>2017-03-16T16:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: Change chart bar color based on data value?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56695#M3009</link>
      <description>&lt;P&gt;awesomeness, thank you v much for this!&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 08:38:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56695#M3009</guid>
      <dc:creator>samhodgson</dc:creator>
      <dc:date>2017-07-14T08:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: Change chart bar color based on data value?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56696#M3010</link>
      <description>&lt;P&gt;@hwakonwalk&lt;BR /&gt;
Have you tried using the stack feature in the formatting? &lt;/P&gt;

&lt;P&gt;This will remove any zero columns. &lt;/P&gt;

&lt;P&gt;It will work if you only have 1 range per timeslot.&lt;/P&gt;

&lt;P&gt;Like this&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://www.dropbox.com/s/u1f8mzaqkyawpmr/Capture.PNG?dl=0" alt="screenshot" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Nov 2017 12:00:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56696#M3010</guid>
      <dc:creator>kmugglet</dc:creator>
      <dc:date>2017-11-23T12:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: Change chart bar color based on data value?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56697#M3011</link>
      <description>&lt;P&gt;Yes, long ago and it worked fine&lt;BR /&gt;
Thanks for the answer &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Nov 2017 12:03:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56697#M3011</guid>
      <dc:creator>hwakonwalk</dc:creator>
      <dc:date>2017-11-23T12:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: Change chart bar color based on data value?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56698#M3012</link>
      <description>&lt;P&gt;No problem &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Nov 2017 12:05:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56698#M3012</guid>
      <dc:creator>kmugglet</dc:creator>
      <dc:date>2017-11-23T12:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: Change chart bar color based on data value?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56699#M3013</link>
      <description>&lt;P&gt;Simply unbelievable, the best logic that I have ever seen, congratulation!&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2020 14:17:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Change-chart-bar-color-based-on-data-value/m-p/56699#M3013</guid>
      <dc:creator>gm_meirelles</dc:creator>
      <dc:date>2020-04-20T14:17:47Z</dc:date>
    </item>
  </channel>
</rss>

