<?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: Pie chart round default percentage in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Pie-chart-round-default-percentage/m-p/373068#M109746</link>
    <description>&lt;P&gt;@ tamduong16, This has definitely been answered before. You will have to calculate percent in your query and then replace your Pie chart label to have Name as well as rounded off percent. Then you turn of the showPercent option since your Label itself will display the percent (without hover)&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/351010/how-to-round-a-percentage-value-in-a-pie-chart-to.html"&gt;https://answers.splunk.com/answers/351010/how-to-round-a-percentage-value-in-a-pie-chart-to.html&lt;/A&gt;&lt;BR /&gt;
Or &lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/589417/how-to-round-the-decimal-percentage-in-a-piechart.html"&gt;https://answers.splunk.com/answers/589417/how-to-round-the-decimal-percentage-in-a-piechart.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Try the following search (it will have better performance than yours)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index="monthlycdr"
| stats count as transportcount by "Transport Type"
| eval transporttype=replace('Transport Type',"\"","") 
| fields - "Transport Type"
| eval transporttype=case( match(transporttype, "voice_sip"), "Sip_voice",match(transporttype, "(?i)sIp"), "Sip", match(transporttype, "(?i)voice_H323"), "H323_voice",match(transporttype, "(?i)H323"), "H323", match(transporttype, "(?i)pstn"), "PSTN")
| eventstats sum(transportcount) as Total
| eval perc=round((transportcount/Total)*100,1)
| eval transporttype=transporttype." (".perc."%)"
| table transporttype transportcount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This performs stats first and then massages the aggregated  data using eval as per our need. In your case eval runs on entire raw data.&lt;/P&gt;</description>
    <pubDate>Thu, 16 Nov 2017 16:48:43 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2017-11-16T16:48:43Z</dc:date>
    <item>
      <title>Pie chart round default percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pie-chart-round-default-percentage/m-p/373067#M109745</link>
      <description>&lt;P&gt;I have the following search:&lt;/P&gt;

&lt;P&gt;index="monthlycdr" |  eval "transporttype"=replace('Transport Type',"\"","")  | eval "tt"=case( match(transporttype, "(?i)voice_sip"), "Sip_voice",match(transporttype, "(?i)sIp"), "Sip", match(transporttype, "(?i)voice_H323"), "H323_voice",match(transporttype, "(?i)H323"), "H323", match(transporttype, "(?i)pstn"), "PSTN") | stats count by tt&lt;/P&gt;

&lt;P&gt;with the option:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://community.splunk.com/storage/temp/219790-a.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;And this is my result picture:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://community.splunk.com/storage/temp/219791-b.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;I know by default splunk has this percentage to 3 decimals. But is there anyway I could round it to 1? If not, how can I calculate it manually in my search base on the search that I have now? I've tried to calculate the percentage from my search but due to the case statement, I can't figure out a way to calculate the percentage value.&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:49:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pie-chart-round-default-percentage/m-p/373067#M109745</guid>
      <dc:creator>tamduong16</dc:creator>
      <dc:date>2020-09-29T16:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: Pie chart round default percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pie-chart-round-default-percentage/m-p/373068#M109746</link>
      <description>&lt;P&gt;@ tamduong16, This has definitely been answered before. You will have to calculate percent in your query and then replace your Pie chart label to have Name as well as rounded off percent. Then you turn of the showPercent option since your Label itself will display the percent (without hover)&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/351010/how-to-round-a-percentage-value-in-a-pie-chart-to.html"&gt;https://answers.splunk.com/answers/351010/how-to-round-a-percentage-value-in-a-pie-chart-to.html&lt;/A&gt;&lt;BR /&gt;
Or &lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/589417/how-to-round-the-decimal-percentage-in-a-piechart.html"&gt;https://answers.splunk.com/answers/589417/how-to-round-the-decimal-percentage-in-a-piechart.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Try the following search (it will have better performance than yours)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index="monthlycdr"
| stats count as transportcount by "Transport Type"
| eval transporttype=replace('Transport Type',"\"","") 
| fields - "Transport Type"
| eval transporttype=case( match(transporttype, "voice_sip"), "Sip_voice",match(transporttype, "(?i)sIp"), "Sip", match(transporttype, "(?i)voice_H323"), "H323_voice",match(transporttype, "(?i)H323"), "H323", match(transporttype, "(?i)pstn"), "PSTN")
| eventstats sum(transportcount) as Total
| eval perc=round((transportcount/Total)*100,1)
| eval transporttype=transporttype." (".perc."%)"
| table transporttype transportcount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This performs stats first and then massages the aggregated  data using eval as per our need. In your case eval runs on entire raw data.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Nov 2017 16:48:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pie-chart-round-default-percentage/m-p/373068#M109746</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-16T16:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Pie chart round default percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pie-chart-round-default-percentage/m-p/373069#M109747</link>
      <description>&lt;P&gt;Although that does the job, since each label will be generated using the percentage attached to it, we can't use the charting.fieldColors option anymore.&lt;BR /&gt;
Unless there's a way to use wildcards in the field name but I know this doesn't work as it is :&lt;BR /&gt;
{"UP*":0x97D2B4,"DOWN*":0xf2963f}&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:59:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pie-chart-round-default-percentage/m-p/373069#M109747</guid>
      <dc:creator>sgessati</dc:creator>
      <dc:date>2020-09-29T17:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: Pie chart round default percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pie-chart-round-default-percentage/m-p/373070#M109748</link>
      <description>&lt;P&gt;@sgessati , you can use CSS Selector to apply color using &lt;CODE&gt;[^UP]&lt;/CODE&gt; or &lt;CODE&gt;[^DOWN]&lt;/CODE&gt;. If you can post a separate question with the series names you intend to use, community members would be able to assist with required CSS.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 15:33:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pie-chart-round-default-percentage/m-p/373070#M109748</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-02-13T15:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: Pie chart round default percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pie-chart-round-default-percentage/m-p/373071#M109749</link>
      <description>&lt;P&gt;@niketnilay , thanks. I almost never use CSS but I'll google CSS Selector.&lt;BR /&gt;
My categories are "UP - {countResults}" and "DOWN - {countResults}". &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 15:47:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pie-chart-round-default-percentage/m-p/373071#M109749</guid>
      <dc:creator>sgessati</dc:creator>
      <dc:date>2018-02-13T15:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: Pie chart round default percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pie-chart-round-default-percentage/m-p/373072#M109750</link>
      <description>&lt;P&gt;On second thought, you can directly rely of charting.seriesColors as far as both DOWN and UP fields are present (i.e. they should show up as 0 instead of not being present in result at all).&lt;/P&gt;

&lt;P&gt;Since DOWN comes before UP in alphabetical order, it will pick up the first series color and UP will pick second series color. Try the following instead of &lt;CODE&gt;charting.fieldColors&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;option name="charting.seriesColors"&amp;gt;["#d93f3c","#65a637"]&amp;lt;/option&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Since CSS override is for SVG element even that would be depended on CSS override to be applied on series rather than field names (unless you use jQuery which will complicate things).&lt;BR /&gt;
@sgessati Please try out and confirm.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 17:19:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pie-chart-round-default-percentage/m-p/373072#M109750</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-02-13T17:19:45Z</dc:date>
    </item>
  </channel>
</rss>

