<?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: Column chart color change if threshold is hit in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432658#M123635</link>
    <description>&lt;P&gt;This is the output the first query I had provided gives. But I was confused with your requirement of stacking the bars/columns. Code 1 can only be either one of Green, Orange or Red but not two or three colors.&lt;/P&gt;

&lt;P&gt;Following is the run anywhere search. The commands till &lt;CODE&gt;| table errorCode Error_Count&lt;/CODE&gt;, generates the data as per your chart in the screenshot.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval data="errorCode=Code 1,Error_Count=10;errorCode=Code 2,Error_Count=20;errorCode=Code 3,Error_Count=30;" 
| makemv data delim=";" 
| mvexpand data 
| rename data as _raw 
| KV 
| table errorCode Error_Count 
| eval Threshold_Color=case(Error_Count&amp;gt;0 AND Error_Count&amp;lt;=20, "1. Normal", Error_Count&amp;gt;20 AND Error_Count&amp;lt;=30, "2. Warning",Error_Count&amp;gt;50 AND Error_Count&amp;lt;=100, "3. Critical",true(),"4. Severe") 
| xyseries errorCode Threshold_Color Error_Count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 10 Aug 2019 16:05:13 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2019-08-10T16:05:13Z</dc:date>
    <item>
      <title>Column chart color change if threshold is hit</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432648#M123625</link>
      <description>&lt;P&gt;Currently, i have a column chart with the default color blue. I want these default color to change if a certain count threshold is met.&lt;/P&gt;

&lt;P&gt;Like, red for count &amp;gt;10, orange for &amp;lt;=10 and &amp;gt; 5, green for &amp;lt;=5.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2019 12:49:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432648#M123625</guid>
      <dc:creator>newbie09</dc:creator>
      <dc:date>2019-08-05T12:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: Column chart color change if threshold is hit</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432649#M123626</link>
      <description>&lt;P&gt;I'm pretty sure your question can be answered by the information in this post:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/350448/how-to-customize-bar-chart-colors-based-on-the-val.html"&gt;How to customize bar chart colors based on the values?&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2019 12:56:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432649#M123626</guid>
      <dc:creator>jpolvino</dc:creator>
      <dc:date>2019-08-05T12:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: Column chart color change if threshold is hit</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432650#M123627</link>
      <description>&lt;P&gt;i already read through those but it doesnt work for my case.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search| where (errorCode = 1 OR errorCode = 2 OR errorCode = 3 )
|stats count by errorCode

--&amp;gt; this is my current search returning column chart (x axis = errorCode(1,2,3) &amp;amp; y axis = count). The bar is defaulted to color blue. my objective is to change the color according to some threshold

search| where (errorCode = 1 OR errorCode = 2 OR errorCode = 3 )
|stats count by errorCode
|eval Critical = if(Error_Count &amp;gt;30,Critical,0)
|eval Warning = if(Error_Count &amp;gt;20,Warning,0)
|eval Normal = if(Error_Count &amp;gt;0,Normal,0)

--&amp;gt; when i tried above, it doesn't suit my objective as my xaxis becomes errorCode ,Critical,Warning,Normal.  With the erroCode bars still defaulted to blue
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Aug 2019 09:25:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432650#M123627</guid>
      <dc:creator>newbie09</dc:creator>
      <dc:date>2019-08-06T09:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: Column chart color change if threshold is hit</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432651#M123628</link>
      <description>&lt;P&gt;@newbie09 try the following, I have introduced a Server block as well but you can get rid of the same as per your need.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;yourMainSearch&amp;gt; errorCode IN (1,2,3)
| stats count as Error_Count by errorCode
| eval Threshold_Color=case(Error_Count&amp;gt;0 AND Error_Count&amp;lt;=20, "1. Normal", Error_Count&amp;gt;20 AND Error_Count&amp;lt;=30, "2. Warning",Error_Count&amp;gt;50 AND Error_Count&amp;lt;=100, "3. Critical",true(),"4. Severe")
| xyseries errorCode Threshold_Color Error_Count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then apply the fieldColors as per Threshold_Color field created.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;        &amp;lt;option name="charting.fieldColors"&amp;gt;{"1. Normal": 0x53A051, "2. Warning": 0xF8BE34, "3. Critical": 0xF1813F, "4. Severe": 0xDC4E41}&amp;lt;/option&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Following is a run anywhere simple XML dashboard example based on Splunk's _internal index for three components as sample:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard&amp;gt;
  &amp;lt;label&amp;gt;Chart Color by Threshold&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;index=_internal sourcetype=splunkd component IN ("ExecProcessor", "SearchAssistant","TimeoutHeap") 
| stats count as Error_Count by component 
| eval Threshold_Color=case(Error_Count&amp;gt;0 AND Error_Count&amp;lt;=10, "1. Normal", Error_Count&amp;gt;10 AND Error_Count&amp;lt;=50, "2. Warning",Error_Count&amp;gt;50 AND Error_Count&amp;lt;=100, "3. Critical",true(),"4. Severe")
| xyseries component Threshold_Color Error_Count&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.chart"&amp;gt;column&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;{"1. Normal": 0x53A051, "2. Warning": 0xF8BE34, "3. Critical": 0xF1813F, "4. Severe": 0xDC4E41}&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;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Aug 2019 16:17:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432651#M123628</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-08-06T16:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: Column chart color change if threshold is hit</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432652#M123629</link>
      <description>&lt;P&gt;exactly what i needed. Thanks mate!&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2019 01:08:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432652#M123629</guid>
      <dc:creator>newbie09</dc:creator>
      <dc:date>2019-08-07T01:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: Column chart color change if threshold is hit</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432653#M123630</link>
      <description>&lt;P&gt;@niketnilay &lt;BR /&gt;
Just noticed that it actually creates another column chart for each of the Threshold_Colors.&lt;/P&gt;

&lt;P&gt;Is it possible just to create 1 (combine to a single column chart just that the colors will be different?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2019 05:12:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432653#M123630</guid>
      <dc:creator>newbie09</dc:creator>
      <dc:date>2019-08-07T05:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: Column chart color change if threshold is hit</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432654#M123631</link>
      <description>&lt;P&gt;@newbie09 the reason why you previously had only one color Blue applied to your series was because you had only one series available i.e. Error Count. In order to apply different color you would need different series created. Which is what I have done through KPI status as Normal, Warning etc. You still have the Error Codes that you are interested in on the x-axis like before.&lt;/P&gt;

&lt;P&gt;If you need series colors for distinction then you would need to have different series names as in the example.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 03:52:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432654#M123631</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-08-08T03:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Column chart color change if threshold is hit</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432655#M123632</link>
      <description>&lt;P&gt;let me confirm my understanding, so basically there's no way that i can only have 1 bar chart with different colors according to threshold? i will always have 1 bar chart of each color?&lt;/P&gt;</description>
      <pubDate>Sat, 10 Aug 2019 00:09:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432655#M123632</guid>
      <dc:creator>newbie09</dc:creator>
      <dc:date>2019-08-10T00:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: Column chart color change if threshold is hit</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432656#M123633</link>
      <description>&lt;P&gt;@newbie09 yes it is possible to have single bar with multiple threshold in the same bar. This can be done using Stacked Column chart option. But what is the criteria for having multiple threshold for each stack? You have not provided that in your requirement.&lt;/P&gt;

&lt;P&gt;Requirement can not be driven by visualization. You should have visualization driven by final output data that you have.&lt;/P&gt;

&lt;P&gt;i.e. "I want to have stacked bar chart for Count of Error Codes with Threshold" is not possible because it is missing the information about what to create stacks for.&lt;/P&gt;

&lt;P&gt;"I have Count of Error Codes with Threshold bucketed hourly. What is the best way to visualize?" In this case Stacked Bar chart can be used because hourly buckets are used for counting Error Codes. Hence multiple stacks for each Error Codes for each hourly aggregation will fall under different Thresholds.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal sourcetype=splunkd NOT (component IN ("Metrics","PeriodicHealthReporter"))
| bin _time span=1h
| stats count as Error_Count by _time component 
| eval Threshold_Color=case(Error_Count&amp;gt;0 AND Error_Count&amp;lt;=10, "1. Normal", Error_Count&amp;gt;10 AND Error_Count&amp;lt;=20, "2. Warning",Error_Count&amp;gt;20 AND Error_Count&amp;lt;=50, "3. Critical",true(),"4. Severe")
| xyseries component Threshold_Color Error_Count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Refer to Splunk Documentation for creation of Stacked Bar Chart:&lt;BR /&gt;
One of the the run anywhere search example is : &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Viz/ColumnBarCharts#Stacked_column_chart"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Viz/ColumnBarCharts#Stacked_column_chart&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal sourcetype=splunkd NOT (component IN ("Metrics","PeriodicHealthReporter"))
| timechart count as Error_Count by component
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or the documentation: &lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/7.2.6/Viz/LineAreaCharts#Stacked_area_chart"&gt;https://docs.splunk.com/Documentation/SplunkCloud/7.2.6/Viz/LineAreaCharts#Stacked_area_chart&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Aug 2019 02:54:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432656#M123633</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-08-10T02:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: Column chart color change if threshold is hit</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432657#M123634</link>
      <description>&lt;P&gt;@niketnilay &lt;/P&gt;

&lt;P&gt;You are very helpful and apologies i should say column chart and not bar chart.&lt;/P&gt;

&lt;P&gt;I admit i wasn't clear. But please take a look at the pic i attached.&lt;/P&gt;

&lt;P&gt;COlor Mapping&lt;BR /&gt;
Green &amp;lt;= 10&lt;BR /&gt;
Orange &amp;gt;10 &amp;lt;=20&lt;BR /&gt;
Red &amp;gt; 20&lt;/P&gt;

&lt;P&gt;Since, Code 1 is 10 color is green&lt;BR /&gt;
and code 2 20 color suppose to be orange and code 3 is 30 and color is suppose to be red. &lt;/P&gt;

&lt;P&gt;&lt;A href="https://ibb.co/r6vPMBY"&gt;https://ibb.co/r6vPMBY&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://ibb.co/r6vPMBY" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Aug 2019 14:54:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432657#M123634</guid>
      <dc:creator>newbie09</dc:creator>
      <dc:date>2019-08-10T14:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: Column chart color change if threshold is hit</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432658#M123635</link>
      <description>&lt;P&gt;This is the output the first query I had provided gives. But I was confused with your requirement of stacking the bars/columns. Code 1 can only be either one of Green, Orange or Red but not two or three colors.&lt;/P&gt;

&lt;P&gt;Following is the run anywhere search. The commands till &lt;CODE&gt;| table errorCode Error_Count&lt;/CODE&gt;, generates the data as per your chart in the screenshot.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval data="errorCode=Code 1,Error_Count=10;errorCode=Code 2,Error_Count=20;errorCode=Code 3,Error_Count=30;" 
| makemv data delim=";" 
| mvexpand data 
| rename data as _raw 
| KV 
| table errorCode Error_Count 
| eval Threshold_Color=case(Error_Count&amp;gt;0 AND Error_Count&amp;lt;=20, "1. Normal", Error_Count&amp;gt;20 AND Error_Count&amp;lt;=30, "2. Warning",Error_Count&amp;gt;50 AND Error_Count&amp;lt;=100, "3. Critical",true(),"4. Severe") 
| xyseries errorCode Threshold_Color Error_Count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Aug 2019 16:05:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432658#M123635</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-08-10T16:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: Column chart color change if threshold is hit</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432659#M123636</link>
      <description>&lt;P&gt;sorry, i tried but i'm still not getting the result i wanted.&lt;/P&gt;

&lt;P&gt;If i use the below, i got separate chart per color as per attached pic. &lt;/P&gt;

&lt;P&gt;&lt;A href="https://ibb.co/WP28T9K" target="_blank"&gt;https://ibb.co/WP28T9K&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;|myresult&lt;BR /&gt;
| eval Threshold_Color=case(Error_Count&amp;gt;0 AND Error_Count&amp;lt;=20, "1. Normal", Error_Count&amp;gt;20 AND Error_Count&amp;lt;=30, "2. Warning",Error_Count&amp;gt;50 AND Error_Count&amp;lt;=100, "3. Critical",true(),"4. Severe") &lt;BR /&gt;
 | xyseries errorCode Threshold_Color Error_Count&lt;/P&gt;

&lt;P&gt;If i use below, still 1 color for every bar in the column chart. pic 2 attached. It is disregarding my color threshold.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://ibb.co/9nYR9BY" target="_blank"&gt;https://ibb.co/9nYR9BY&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;|myresult&lt;BR /&gt;
| table errorCode Error_Count &lt;BR /&gt;
 | eval Threshold_Color=case(Error_Count&amp;gt;0 AND Error_Count&amp;lt;=20, "1. Normal", Error_Count&amp;gt;20 AND Error_Count&amp;lt;=30, "2. Warning",Error_Count&amp;gt;50 AND Error_Count&amp;lt;=100, "3. Critical",true(),"4. Severe") &lt;BR /&gt;
 | xyseries errorCode Threshold_Color Error_Count&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:40:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432659#M123636</guid>
      <dc:creator>newbie09</dc:creator>
      <dc:date>2020-09-30T01:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: Column chart color change if threshold is hit</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432660#M123637</link>
      <description>&lt;P&gt;@newbie09 for first chart image added in your comment, seems like you are using Trellis layout. Can you turn Trellis off and see if it matches your expected output?&lt;/P&gt;</description>
      <pubDate>Sun, 11 Aug 2019 02:34:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432660#M123637</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-08-11T02:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: Column chart color change if threshold is hit</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432661#M123638</link>
      <description>&lt;P&gt;@niketnilay&lt;/P&gt;

&lt;P&gt;it's not the trellis fault but the multimode series.&lt;/P&gt;

&lt;P&gt;If i only see this from the start.&lt;/P&gt;

&lt;P&gt;I really appreciate your time helping me to point out what i'm doing wrong.&lt;/P&gt;</description>
      <pubDate>Sun, 11 Aug 2019 06:25:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432661#M123638</guid>
      <dc:creator>newbie09</dc:creator>
      <dc:date>2019-08-11T06:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: Column chart color change if threshold is hit</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432662#M123639</link>
      <description>&lt;P&gt;I hope your issue is resolved. Do up-vote the comments that helped &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Aug 2019 16:33:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Column-chart-color-change-if-threshold-is-hit/m-p/432662#M123639</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-08-11T16:33:06Z</dc:date>
    </item>
  </channel>
</rss>

