<?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 column colors in a chart based on a duration value? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-column-colors-in-a-chart-based-on-a-duration-value/m-p/198869#M57546</link>
    <description>&lt;P&gt;You can split the counts into two different variables and then display them as a stacked bar chart. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    | eval red=Case(count&amp;lt;15,count,count&amp;gt;=15,0) 
    | eval green=Case(count&amp;gt;=15,count,count&amp;lt;15,0)
    | table job_id, red, green
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;your data will look similar to this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Case|   Count|  Red|    Green|
1       8       8       0
2       1       1       0
3       11      11      0
4       55      0       55
5       44      0       44
6       233     0       233
7       48      0       48
8       10      10      0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then create a bar chart with both Red and Green and use the &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.3/Viz/Chartcustomization#Chart_colors"&gt;charting.fieldColors&lt;/A&gt; setting in the XML to designate the colors of each variable&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;option name="charting.fieldColors"&amp;gt;{"Red":0xFF0000,"Green":0x00FF00}&amp;lt;/option&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 03 Sep 2014 17:35:11 GMT</pubDate>
    <dc:creator>schatzb</dc:creator>
    <dc:date>2014-09-03T17:35:11Z</dc:date>
    <item>
      <title>How to change column colors in a chart based on a duration value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-column-colors-in-a-chart-based-on-a-duration-value/m-p/198866#M57543</link>
      <description>&lt;P&gt;I have a search that compares values in two files and comes up with duration it took to process a job.&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;index=abc sourcetype=abc source=&lt;EM&gt;PRD&lt;/EM&gt; | eval otime=strptime(pub_date,"%Y-%m-%d %H:%M:%S") | join jobid [search index=abc sourcetype=abc_response source=&lt;EM&gt;PRD&lt;/EM&gt; | eval "Response_Status"=status | eval rtime=strptime(comp_date,"%Y-%m-%d %H:%M:%S")] | eval d=rtime-otime | eval Duration=d/60 |table jobid,Duration,| reverse&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Jobid is individual and will only appear once. The output is then graphed in dashboard. At the moment all columns in graph are blue. I need the columns to be either green or red depending if duration is greater or less than 15. It should be green if duration &amp;lt; 15 and red if duration &amp;gt; 15&lt;/P&gt;

&lt;P&gt;Tried adding additional eval but it throws error in 'eval' command: Fields cannot be assigned a boolean result. Instead, try if([bool expr], [expr], [expr]). None of these seem to work for me.&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;index=abc sourcetype=abc source=&lt;EM&gt;PRD&lt;/EM&gt; | eval otime=strptime(pub_date,"%Y-%m-%d %H:%M:%S") | join jobid [search index=abc sourcetype=abc_response source=&lt;EM&gt;PRD&lt;/EM&gt; | eval "Response_Status"=status | eval rtime=strptime(comp_date,"%Y-%m-%d %H:%M:%S")] | eval d=rtime-otime | eval Duration=d/60 |eval urgent = duration &amp;gt; (15*60) |table jobid,Duration,| reverse  &lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Any help much appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:27:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-column-colors-in-a-chart-based-on-a-duration-value/m-p/198866#M57543</guid>
      <dc:creator>briangmadden</dc:creator>
      <dc:date>2020-09-28T17:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to change column colors in a chart based on a duration value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-column-colors-in-a-chart-based-on-a-duration-value/m-p/198867#M57544</link>
      <description>&lt;P&gt;Check these&lt;/P&gt;

&lt;P&gt;&lt;A href="http://answers.splunk.com/answers/58335/change-chart-bar-color-based-on-data-value"&gt;http://answers.splunk.com/answers/58335/change-chart-bar-color-based-on-data-value&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://answers.splunk.com/answers/145120/bar-chart-column-color-based-on-value"&gt;http://answers.splunk.com/answers/145120/bar-chart-column-color-based-on-value&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Sep 2014 15:23:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-column-colors-in-a-chart-based-on-a-duration-value/m-p/198867#M57544</guid>
      <dc:creator>strive</dc:creator>
      <dc:date>2014-09-01T15:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to change column colors in a chart based on a duration value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-column-colors-in-a-chart-based-on-a-duration-value/m-p/198868#M57545</link>
      <description>&lt;P&gt;Have you tried creating your search in a Pivot, this will easily allow you to configure your graph via different color for different durations.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Sep 2014 19:31:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-column-colors-in-a-chart-based-on-a-duration-value/m-p/198868#M57545</guid>
      <dc:creator>gpalla91</dc:creator>
      <dc:date>2014-09-01T19:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to change column colors in a chart based on a duration value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-column-colors-in-a-chart-based-on-a-duration-value/m-p/198869#M57546</link>
      <description>&lt;P&gt;You can split the counts into two different variables and then display them as a stacked bar chart. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    | eval red=Case(count&amp;lt;15,count,count&amp;gt;=15,0) 
    | eval green=Case(count&amp;gt;=15,count,count&amp;lt;15,0)
    | table job_id, red, green
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;your data will look similar to this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Case|   Count|  Red|    Green|
1       8       8       0
2       1       1       0
3       11      11      0
4       55      0       55
5       44      0       44
6       233     0       233
7       48      0       48
8       10      10      0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then create a bar chart with both Red and Green and use the &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.3/Viz/Chartcustomization#Chart_colors"&gt;charting.fieldColors&lt;/A&gt; setting in the XML to designate the colors of each variable&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;option name="charting.fieldColors"&amp;gt;{"Red":0xFF0000,"Green":0x00FF00}&amp;lt;/option&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Sep 2014 17:35:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-column-colors-in-a-chart-based-on-a-duration-value/m-p/198869#M57546</guid>
      <dc:creator>schatzb</dc:creator>
      <dc:date>2014-09-03T17:35:11Z</dc:date>
    </item>
  </channel>
</rss>

