<?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 change bar chart color based on its value? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-bar-chart-color-based-on-its-value/m-p/549457#M155902</link>
    <description>&lt;P&gt;Thank you for your reply! it's a shame Splunk does not have an option to display different colors based on the value of a bar though... is there any app we could install to sort this out or any palliative action we could do?&lt;/P&gt;</description>
    <pubDate>Tue, 27 Apr 2021 13:04:57 GMT</pubDate>
    <dc:creator>Mark90</dc:creator>
    <dc:date>2021-04-27T13:04:57Z</dc:date>
    <item>
      <title>How to change bar chart color based on its value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-bar-chart-color-based-on-its-value/m-p/549341#M155866</link>
      <description>&lt;P&gt;We are monitoring the C: drive free space of our whole infrastructure, and would like to create a bar chart with color coding based on different thresholds. We have tried different things in XML, in the query itself but nothing seems to be working for us... for now our query and graph looks like this:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;|mstats latest(_value) as value WHERE metric_name=win:disk.Free_Megabytes AND index=myindex AND instance="C:" BY host&lt;BR /&gt;| eval Free Space (GB)=round((value)/1024,2)&lt;BR /&gt;|sort "Free Space (GB)" - asc | head 20&lt;BR /&gt;| table host "Free Space (GB)"&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mark90_0-1619445594947.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/13915i99E978B052C7E670/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Mark90_0-1619445594947.png" alt="Mark90_0-1619445594947.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;We would like to have a RED-AMBER-GREEN color based on the following limits RED= 0-3 AMBER 3-8 GREEN &amp;gt; 8&lt;BR /&gt;&lt;BR /&gt;I have tried rangemap, and creating a new field based on these same limits to try to filter them in the XML but to no avail:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mark90_1-1619446446933.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/13916i172B5A3107EDD1AF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Mark90_1-1619446446933.png" alt="Mark90_1-1619446446933.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mark90_2-1619446469585.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/13917iEEDC99EFE01CF057/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Mark90_2-1619446469585.png" alt="Mark90_2-1619446469585.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help in figuring this out is more than welcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 14:17:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-bar-chart-color-based-on-its-value/m-p/549341#M155866</guid>
      <dc:creator>Mark90</dc:creator>
      <dc:date>2021-04-26T14:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to change bar chart color based on its value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-bar-chart-color-based-on-its-value/m-p/549380#M155877</link>
      <description>&lt;P&gt;This is not possible with a bar chart. The bars for the series are drawn as a single shape so will all have the same colour.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 22:42:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-bar-chart-color-based-on-its-value/m-p/549380#M155877</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-04-26T22:42:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to change bar chart color based on its value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-bar-chart-color-based-on-its-value/m-p/549457#M155902</link>
      <description>&lt;P&gt;Thank you for your reply! it's a shame Splunk does not have an option to display different colors based on the value of a bar though... is there any app we could install to sort this out or any palliative action we could do?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 13:04:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-bar-chart-color-based-on-its-value/m-p/549457#M155902</guid>
      <dc:creator>Mark90</dc:creator>
      <dc:date>2021-04-27T13:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to change bar chart color based on its value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-bar-chart-color-based-on-its-value/m-p/549565#M155943</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/233833"&gt;@Mark90&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can actually do it by creating a new column for each of the ranges and store the Free GB in that column and then assign different colours to each of those 3 fields. Then if you configure your bar chart as stacked, you won't see any gaps between the bars for the null values.&lt;/P&gt;&lt;P&gt;See this example dashboard and look at how the result matrix is shaped. The fieldcolors config line defines the colours for each of the ranges.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;dashboard&amp;gt;
  &amp;lt;label&amp;gt;bars&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;chart&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;|makeresults count=20
| streamstats c
| eval host="host".c
| fields - c _time
| eval FreeGB=random() % 200000/10000
| rangemap field=FreeGB severe=0-2.99 elevated=3-7.99 low=8-100 
| eval {range}=FreeGB
| sort FreeGB
| streamstats c
| fields - FreeGB range
| chart values(*) as * over host
| sort c
| fields - c&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="charting.axisLabelsX.majorLabelStyle.overflowMode"&amp;gt;ellipsisNone&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisLabelsX.majorLabelStyle.rotation"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisTitleX.visibility"&amp;gt;visible&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisTitleY.text"&amp;gt;Free Space in GB&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisTitleY.visibility"&amp;gt;visible&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisTitleY2.visibility"&amp;gt;visible&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisX.abbreviation"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisX.scale"&amp;gt;linear&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY.abbreviation"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY.scale"&amp;gt;linear&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY2.abbreviation"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY2.enabled"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY2.scale"&amp;gt;inherit&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart"&amp;gt;bar&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.bubbleMaximumSize"&amp;gt;50&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.bubbleMinimumSize"&amp;gt;10&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.bubbleSizeBy"&amp;gt;area&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.nullValueMode"&amp;gt;gaps&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.showDataLabels"&amp;gt;all&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.sliceCollapsingThreshold"&amp;gt;0.01&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.chart.style"&amp;gt;shiny&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.fieldColors"&amp;gt;{"severe": 0xFF0000, "elevated": 0xFF9900, "low":0x008000}&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.layout.splitSeries"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.layout.splitSeries.allowIndependentYRanges"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.legend.labelStyle.overflowMode"&amp;gt;ellipsisMiddle&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.legend.mode"&amp;gt;standard&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.lineWidth"&amp;gt;2&amp;lt;/option&amp;gt;
        &amp;lt;option name="height"&amp;gt;502&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.enabled"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.scales.shared"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.size"&amp;gt;medium&amp;lt;/option&amp;gt;
      &amp;lt;/chart&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The syntax of&amp;nbsp;&lt;/P&gt;&lt;P&gt;| eval {range}=FreeGB&lt;/P&gt;&lt;P&gt;will create a new column with the value of range and store the free GB in that.&lt;/P&gt;&lt;P&gt;Edited to include sorting&lt;/P&gt;</description>
      <pubDate>Wed, 28 Apr 2021 06:31:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-bar-chart-color-based-on-its-value/m-p/549565#M155943</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-04-28T06:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to change bar chart color based on its value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-bar-chart-color-based-on-its-value/m-p/549567#M155944</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bowesmana_0-1619591596704.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/13939i88FE3AD7FCE51E4B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bowesmana_0-1619591596704.png" alt="bowesmana_0-1619591596704.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Apr 2021 06:33:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-bar-chart-color-based-on-its-value/m-p/549567#M155944</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-04-28T06:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to change bar chart color based on its value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-bar-chart-color-based-on-its-value/m-p/549608#M155959</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt; ! Thanks so much for the detailed explanation, I had to adjust it to our metric and tag lookup but it worked like a charm!!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mark90_0-1619614727499.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/13945i9D5BDEE44E6B3556/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Mark90_0-1619614727499.png" alt="Mark90_0-1619614727499.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Wed, 28 Apr 2021 12:59:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-bar-chart-color-based-on-its-value/m-p/549608#M155959</guid>
      <dc:creator>Mark90</dc:creator>
      <dc:date>2021-04-28T12:59:06Z</dc:date>
    </item>
  </channel>
</rss>

