<?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 colors on bars of a chart according to column values? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-colors-on-bars-of-a-chart-according-to-column/m-p/466979#M131420</link>
    <description>&lt;P&gt;@nagar57, try the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=&amp;lt;&amp;gt; sourcetype=&amp;lt;&amp;gt; source=&amp;lt;&amp;gt; channel IN ("A","B","C")
 | stats count by channel
 | transpose 3 header_field=channel
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or else if you want to stick to your query, try the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=&amp;lt;&amp;gt; sourcetype=&amp;lt;&amp;gt; source=&amp;lt;&amp;gt; channel IN ("A","B","C")
| stats count(eval(channel="A")) as A count(eval(channel="B")) as B count(eval(channel="C")) as C
| eval channel="count"
| fields channel A B C
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 30 May 2020 14:34:39 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2020-05-30T14:34:39Z</dc:date>
    <item>
      <title>How to change colors on bars of a chart according to column values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-colors-on-bars-of-a-chart-according-to-column/m-p/466977#M131418</link>
      <description>&lt;P&gt;I want to apply different colors on different bars according to my Column values.&lt;BR /&gt;My column values are: A,B,C. These will remain fixed.&lt;/P&gt;
&lt;P&gt;I tried this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;search&amp;gt;
&amp;lt;query&amp;gt;index=&amp;lt;&amp;gt; sourcetype=&amp;lt;&amp;gt; source=&amp;lt;&amp;gt;
| stats count(eval(channel="A")) as A count(eval(channel="B")) as B count(eval(channel="C")) as C&amp;lt;/query&amp;gt;
&amp;lt;earliest&amp;gt;$earnTime.earliest$&amp;lt;/earliest&amp;gt;
&amp;lt;latest&amp;gt;$earnTime.latest$&amp;lt;/latest&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;collapsed&amp;lt;/option&amp;gt;
&amp;lt;option name="charting.axisTitleY.visibility"&amp;gt;collapsed&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.scale"&amp;gt;linear&amp;lt;/option&amp;gt;
&amp;lt;option name="charting.axisY.minimumNumber"&amp;gt;0&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.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;column&amp;lt;/option&amp;gt;
&amp;lt;option name="charting.chart.bubbleMaximumSize"&amp;gt;10&amp;lt;/option&amp;gt;
&amp;lt;option name="charting.chart.bubbleMinimumSize"&amp;gt;1&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.columnSpacing"&amp;gt;20&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&amp;lt;/option&amp;gt;
&amp;lt;option name="charting.chart.stackMode"&amp;gt;default&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;{"A":0x009900, "B":0x0099CC, "C":0xCC6600}&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.placement"&amp;gt;none&amp;lt;/option&amp;gt;
&amp;lt;option name="height"&amp;gt;198&amp;lt;/option&amp;gt;
&amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But my "A" value is not coming in the graph and getting aligned on x axis with the count.&lt;BR /&gt;Can someone please tell me where I am going wrong?&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/9008iCEAEF15B1FB96284/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 18:12:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-colors-on-bars-of-a-chart-according-to-column/m-p/466977#M131418</guid>
      <dc:creator>nagar57</dc:creator>
      <dc:date>2020-06-08T18:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to change colors on bars of a chart according to column values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-colors-on-bars-of-a-chart-according-to-column/m-p/466978#M131419</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;&amp;lt;query&amp;gt;| tstats count where index=&amp;lt;&amp;gt; sourcetype=&amp;lt;&amp;gt; source=&amp;lt;&amp;gt; by channel| where IN(channel,"A","B","C")&amp;lt;/query&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;your statistics result should have two columns, &lt;EM&gt;channel&lt;/EM&gt; and &lt;EM&gt;count&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 30 May 2020 01:11:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-colors-on-bars-of-a-chart-according-to-column/m-p/466978#M131419</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-05-30T01:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to change colors on bars of a chart according to column values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-colors-on-bars-of-a-chart-according-to-column/m-p/466979#M131420</link>
      <description>&lt;P&gt;@nagar57, try the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=&amp;lt;&amp;gt; sourcetype=&amp;lt;&amp;gt; source=&amp;lt;&amp;gt; channel IN ("A","B","C")
 | stats count by channel
 | transpose 3 header_field=channel
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or else if you want to stick to your query, try the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=&amp;lt;&amp;gt; sourcetype=&amp;lt;&amp;gt; source=&amp;lt;&amp;gt; channel IN ("A","B","C")
| stats count(eval(channel="A")) as A count(eval(channel="B")) as B count(eval(channel="C")) as C
| eval channel="count"
| fields channel A B C
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 30 May 2020 14:34:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-colors-on-bars-of-a-chart-according-to-column/m-p/466979#M131420</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-05-30T14:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to change colors on bars of a chart according to column values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-colors-on-bars-of-a-chart-according-to-column/m-p/466980#M131421</link>
      <description>&lt;P&gt;@niketnilay  I was able to figure out this workaround by my own. But I am not able to get one thing. Just like Pie charts we can give colors as ".serieColors" and it gets reflected automatically in the Chart. Then why Column/Bar charts don't behave like this.&lt;BR /&gt;
And one last thing why the 1st column is going to the x-axis in your above solution or why I need to create a dummy 1st column so that other columns can align properly in the chart.?&lt;/P&gt;</description>
      <pubDate>Sat, 30 May 2020 16:33:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-colors-on-bars-of-a-chart-according-to-column/m-p/466980#M131421</guid>
      <dc:creator>nagar57</dc:creator>
      <dc:date>2020-05-30T16:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to change colors on bars of a chart according to column values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-colors-on-bars-of-a-chart-according-to-column/m-p/466981#M131422</link>
      <description>&lt;P&gt;&lt;CODE&gt;charting.seriesColors&lt;/CODE&gt; is available for all charts. When you don't do &lt;CODE&gt;transpose&lt;/CODE&gt; or &lt;CODE&gt;eval(count(field)) as field&lt;/CODE&gt; you have only one series (which is shown as legend, in above case &lt;CODE&gt;count&lt;/CODE&gt;). So there will be only one color for only one series i.e. count.&lt;/P&gt;

&lt;P&gt;Think what are you plotting, how would chart know what is your x-axis and y-axis. Usually first column goes as x-axis and Other column names make the series/legend.&lt;/P&gt;

&lt;P&gt;For example for if you do &lt;CODE&gt;| timechart count by field&lt;/CODE&gt;, _time becomes x-axis and field values make the series or legends.&lt;/P&gt;

&lt;P&gt;Hope it clarifies stuff! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 30 May 2020 17:10:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-colors-on-bars-of-a-chart-according-to-column/m-p/466981#M131422</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-05-30T17:10:33Z</dc:date>
    </item>
  </channel>
</rss>

