<?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 Unable to create Pie Chart with desired field colors in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Unable-to-create-Pie-Chart-with-desired-field-colors/m-p/497090#M32552</link>
    <description>&lt;P&gt;Hi Guys,&lt;/P&gt;

&lt;P&gt;I am trying to create pie chart with below query but unfortunately i am not getting desired result.&lt;/P&gt;

&lt;P&gt;sourcetype="web_ping" &lt;CODE&gt;website_monitoring_search_index&lt;/CODE&gt; title=&lt;EM&gt;| fillnull value=1000 response_code | eval success=case(response_code&amp;gt;=400, 0, timed_out == "True", 0, response_code="", 0) | fillnull value=1 success  |stats count as total, sum(success) as successes by title| eval availability=round(100&lt;/EM&gt;(successes/total),2)  |eval failures=(100-'availability')| eval result=availability + " - " + failures|stats count by title result&lt;/P&gt;

&lt;P&gt;What I am looking for is Pie chart to have 2 colors i.e. Availability should be in green and Failures should be shown in red and distributed according to their percent values in the pie.&lt;/P&gt;

&lt;P&gt;I did trial and error with below xml but it did not work &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;option name="charting.legend.labels"&amp;gt;[availability,failures]&amp;lt;/option&amp;gt;
    &amp;lt;option name="charting.seriesColors"&amp;gt;[#00ff00,#ff0006]&amp;lt;/option&amp;gt;
    &amp;lt;option name="charting.fieldColors"&amp;gt;{"availability":#00ff00 "failures":#ff0006}&amp;lt;/option&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Currently I am getting output in below format with my above query -&lt;/P&gt;

&lt;P&gt;title        result           count &lt;BR /&gt;
abc    100.00 - 0.00   1&lt;BR /&gt;
xyz     96.67 - 3.33     1&lt;BR /&gt;
pqr    91.00 - 9.00     1&lt;/P&gt;

&lt;P&gt;Can someone please help me figure out the right way to do this&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 03:55:56 GMT</pubDate>
    <dc:creator>ak9092</dc:creator>
    <dc:date>2020-09-30T03:55:56Z</dc:date>
    <item>
      <title>Unable to create Pie Chart with desired field colors</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Unable-to-create-Pie-Chart-with-desired-field-colors/m-p/497090#M32552</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;

&lt;P&gt;I am trying to create pie chart with below query but unfortunately i am not getting desired result.&lt;/P&gt;

&lt;P&gt;sourcetype="web_ping" &lt;CODE&gt;website_monitoring_search_index&lt;/CODE&gt; title=&lt;EM&gt;| fillnull value=1000 response_code | eval success=case(response_code&amp;gt;=400, 0, timed_out == "True", 0, response_code="", 0) | fillnull value=1 success  |stats count as total, sum(success) as successes by title| eval availability=round(100&lt;/EM&gt;(successes/total),2)  |eval failures=(100-'availability')| eval result=availability + " - " + failures|stats count by title result&lt;/P&gt;

&lt;P&gt;What I am looking for is Pie chart to have 2 colors i.e. Availability should be in green and Failures should be shown in red and distributed according to their percent values in the pie.&lt;/P&gt;

&lt;P&gt;I did trial and error with below xml but it did not work &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;option name="charting.legend.labels"&amp;gt;[availability,failures]&amp;lt;/option&amp;gt;
    &amp;lt;option name="charting.seriesColors"&amp;gt;[#00ff00,#ff0006]&amp;lt;/option&amp;gt;
    &amp;lt;option name="charting.fieldColors"&amp;gt;{"availability":#00ff00 "failures":#ff0006}&amp;lt;/option&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Currently I am getting output in below format with my above query -&lt;/P&gt;

&lt;P&gt;title        result           count &lt;BR /&gt;
abc    100.00 - 0.00   1&lt;BR /&gt;
xyz     96.67 - 3.33     1&lt;BR /&gt;
pqr    91.00 - 9.00     1&lt;/P&gt;

&lt;P&gt;Can someone please help me figure out the right way to do this&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:55:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Unable-to-create-Pie-Chart-with-desired-field-colors/m-p/497090#M32552</guid>
      <dc:creator>ak9092</dc:creator>
      <dc:date>2020-09-30T03:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to create Pie Chart with desired field colors</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Unable-to-create-Pie-Chart-with-desired-field-colors/m-p/497091#M32553</link>
      <description>&lt;P&gt;Check your result: (Viz&amp;gt; Pie Chart with trellis)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="title,result,count
abc,100.00 - 0.00,1
xyz,96.67 - 3.33,1
pqr,91.00 - 9.00,1"
| multikv forceheader=1
| table title,result,count
| eval availability=mvindex(split(result," "),0), failures=mvindex(split(result," "),-1)
| table  title availability failures
| transpose header_field=title column_name=status
| stats values(*) as * by status
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Recommend:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="web_ping" `website_monitoring_search_index` title= 
| fillnull value=1000 response_code 
| eval success=case(response_code&amp;gt;=400, 0, timed_out == "True", 0, response_code="", 0) 
| fillnull value=1 success 
| stats count as total, sum(success) as successes by title 
| eval availability=round(100(successes/total),2) 
| eval failures=(100-'availability') 
| table title availability failures 
| transpose header_field=title column_name=status 
| stats values(*) as * by status
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Change color as you like.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 02:16:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Unable-to-create-Pie-Chart-with-desired-field-colors/m-p/497091#M32553</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-29T02:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to create Pie Chart with desired field colors</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Unable-to-create-Pie-Chart-with-desired-field-colors/m-p/497092#M32554</link>
      <description>&lt;P&gt;That's working perfectly!! Thanks a lot for your help.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 08:01:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Unable-to-create-Pie-Chart-with-desired-field-colors/m-p/497092#M32554</guid>
      <dc:creator>ak9092</dc:creator>
      <dc:date>2020-01-29T08:01:03Z</dc:date>
    </item>
  </channel>
</rss>

