<?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 can I define a total amount of a Pie Chart? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-define-a-total-amount-of-a-Pie-Chart/m-p/344818#M102157</link>
    <description>&lt;P&gt;The whole pie represents Total (100 %) so it won't be possible show your count and total as slice in pie chart. Options for you would be&lt;BR /&gt;
1) Use post process search panels, may be a single value or html panel to show Total before/after the pie chart one. Where pie chart will show 'Used' and 'Remaining '.&lt;BR /&gt;
2) Show 'Used' and 'Remaining' in pie chart and add the Total value in the column labels.&lt;/P&gt;</description>
    <pubDate>Mon, 06 Nov 2017 19:09:44 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2017-11-06T19:09:44Z</dc:date>
    <item>
      <title>How can I define a total amount of a Pie Chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-define-a-total-amount-of-a-Pie-Chart/m-p/344816#M102155</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;
I need to create a pie chart where the full pie is 1000000 and the "usage" is a count number.&lt;BR /&gt;
It should look like this:&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3780iAAAADF57AE9EDD4C/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I have Json data like this:&lt;BR /&gt;
{&lt;BR /&gt;
Name: ApplicationX&lt;BR /&gt;
NumberOfUsers: 70&lt;BR /&gt;
Version: 2013&lt;BR /&gt;
}&lt;/P&gt;

&lt;P&gt;And I'm using the following Splunk query:&lt;BR /&gt;
MY QUERY | eval Total=1000000 | chart count(NumberOfUsers) by Total&lt;/P&gt;

&lt;P&gt;Could someone please help me?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2017 17:24:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-define-a-total-amount-of-a-Pie-Chart/m-p/344816#M102155</guid>
      <dc:creator>gcescatto</dc:creator>
      <dc:date>2017-11-06T17:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: How can I define a total amount of a Pie Chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-define-a-total-amount-of-a-Pie-Chart/m-p/344817#M102156</link>
      <description>&lt;P&gt;@gcescatto, based on the description seems like your Number Of User upper limit is set to 1000000 which is 100% for pie chart.&lt;/P&gt;

&lt;P&gt;If you just want to display two values i.e. &lt;CODE&gt;Used&lt;/CODE&gt; vs &lt;CODE&gt;Total Max&lt;/CODE&gt;, you should better use on of Gauge Visualizations like &lt;CODE&gt;Radial Gauge&lt;/CODE&gt; in this case. (&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Viz/CreateGauges#Radial_gauge"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Viz/CreateGauges#Radial_gauge&lt;/A&gt;)&lt;/P&gt;

&lt;P&gt;Pie chart is more suitable when you have multiple slices. Not for Used (25%) vs Total(100%). Even if you had two slices they would be Used (25%) vs Unused (75%), so that the two slices would make up the pie (100%). Just to answer your question and make the scenario for pie more relevant I have actually created a run anywhere example (mocking sample jSON provided) to calculate Usage by Application so that we get multiple slices.&lt;/P&gt;

&lt;P&gt;Following is the run anywhere search (&lt;STRONG&gt;The pipes till &lt;CODE&gt;spath&lt;/CODE&gt; mocks data, you would need to plug in your base search to return Name, NumberOfUsers from your jSON data&lt;/STRONG&gt;)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|  makeresults
|  eval _raw="{\"Name\": \"ApplicationX\",\"NumberOfUsers\": 70000,\"Version\": 2013}"
|  append 
    [ makeresults
      |  eval _raw="{\"Name\": \"ApplicationY\",\"NumberOfUsers\": 30000,\"Version\": 2012}"
    ]
|  append 
    [ makeresults
      |  eval _raw="{\"Name\": \"ApplicationY\",\"NumberOfUsers\": 20000,\"Version\": 2012}"
    ]
|  append 
    [ makeresults
      |  eval _raw="{\"Name\": \"ApplicationY\",\"NumberOfUsers\": 30000,\"Version\": 2013}"
    ]
|  spath
|  append 
    [|  makeresults
    |  eval Name="Un-Used", Version=2013]
|  eval TotalMax=1000000
|  stats sum(NumberOfUsers) as NumberOfUsers last(TotalMax) as TotalMax  by Name
|  eventstats sum(NumberOfUsers) as TotalNumberOfUsersAccounted
|  eval NumberOfUsers=if(Name=="Un-Used",TotalMax-TotalNumberOfUsersAccounted,NumberOfUsers)
|  eval perc=round((NumberOfUsers/TotalMax)*100,1)
|  eval Name=Name."(value=".NumberOfUsers.", perc=".perc."%)"
|  table Name NumberOfUsers
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Step 1:&lt;/STRONG&gt; Using append "Un-Used" data needs to be added.&lt;BR /&gt;
&lt;STRONG&gt;Step 2:&lt;/STRONG&gt; Using eval &lt;CODE&gt;TotalMax&lt;/CODE&gt; needs to be set at 1000000&lt;BR /&gt;
&lt;STRONG&gt;Step 3:&lt;/STRONG&gt; using stats total NumberOfUsers per Application is calculated (this is assuming each application may have multiple events in your data. If not you can use &lt;CODE&gt;table&lt;/CODE&gt; as well. However, &lt;CODE&gt;stats&lt;/CODE&gt; will work in both cases &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; )&lt;BR /&gt;
&lt;STRONG&gt;Step 4:&lt;/STRONG&gt; Use eventstats to calculate running total of all NumberOfUsers across all applications and attach &lt;CODE&gt;TotalNumberOfUsersAccounted&lt;/CODE&gt; to each event.&lt;BR /&gt;
&lt;STRONG&gt;Step 5:&lt;/STRONG&gt; Use eval to calculate percentage as &lt;CODE&gt;perc&lt;/CODE&gt;&lt;BR /&gt;
&lt;STRONG&gt;Step 6.&lt;/STRONG&gt; Use eval to change Name to also contain &lt;CODE&gt;value&lt;/CODE&gt; i.e. &lt;CODE&gt;NumberOfUsers&lt;/CODE&gt; and percentage calculated as &lt;CODE&gt;perc&lt;/CODE&gt; by each Application.&lt;BR /&gt;
&lt;STRONG&gt;Step 7:&lt;/STRONG&gt; Create &lt;CODE&gt;table&lt;/CODE&gt; of only require Name Value pair i.e. &lt;CODE&gt;Name&lt;/CODE&gt;, &lt;CODE&gt;NumberOfUsers&lt;/CODE&gt;&lt;BR /&gt;
&lt;STRONG&gt;Step 8:&lt;/STRONG&gt; Set the visualization as Pie Chart.&lt;/P&gt;

&lt;P&gt;Please find the run anywhere dashboard on the same example.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3778iF2DE2CC79B770106/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard&amp;gt;
  &amp;lt;label&amp;gt;Pie Chart used vs unused&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Number of Users Used vs Unused Pie Chart - Total(max)=1000000&amp;lt;/title&amp;gt;
      &amp;lt;chart&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;|  makeresults
|  eval _raw="{\"Name\": \"ApplicationX\",\"NumberOfUsers\": 70000,\"Version\": 2013}"
|  append 
    [ makeresults
      |  eval _raw="{\"Name\": \"ApplicationY\",\"NumberOfUsers\": 30000,\"Version\": 2012}"
    ]
|  append 
    [ makeresults
      |  eval _raw="{\"Name\": \"ApplicationY\",\"NumberOfUsers\": 20000,\"Version\": 2012}"
    ]
|  append 
    [ makeresults
      |  eval _raw="{\"Name\": \"ApplicationY\",\"NumberOfUsers\": 30000,\"Version\": 2013}"
    ]
|  spath
|  append 
    [|  makeresults
    |  eval Name="Un-Used", Version=2013]
|  eval TotalMax=1000000
|  stats sum(NumberOfUsers) as NumberOfUsers last(TotalMax) as TotalMax  by Name
|  eventstats sum(NumberOfUsers) as TotalNumberOfUsersAccounted
|  eval NumberOfUsers=if(Name=="Un-Used",TotalMax-TotalNumberOfUsersAccounted,NumberOfUsers)
|  eval perc=round((NumberOfUsers/TotalMax)*100,1)
|  eval Name=Name."(value=".NumberOfUsers.", perc=".perc."%)"
|  table Name NumberOfUsers&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.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;visible&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisTitleY.visibility"&amp;gt;visible&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.abbreviation"&amp;gt;none&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.abbreviation"&amp;gt;none&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.abbreviation"&amp;gt;none&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;pie&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.bubbleMaximumSize"&amp;gt;50&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.bubbleMinimumSize"&amp;gt;10&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.nullValueMode"&amp;gt;gaps&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.showDataLabels"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.sliceCollapsingThreshold"&amp;gt;0.01&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.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.mode"&amp;gt;standard&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.legend.placement"&amp;gt;right&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.lineWidth"&amp;gt;2&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.enabled"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.scales.shared"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.size"&amp;gt;medium&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>Mon, 06 Nov 2017 18:54:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-define-a-total-amount-of-a-Pie-Chart/m-p/344817#M102156</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-06T18:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: How can I define a total amount of a Pie Chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-define-a-total-amount-of-a-Pie-Chart/m-p/344818#M102157</link>
      <description>&lt;P&gt;The whole pie represents Total (100 %) so it won't be possible show your count and total as slice in pie chart. Options for you would be&lt;BR /&gt;
1) Use post process search panels, may be a single value or html panel to show Total before/after the pie chart one. Where pie chart will show 'Used' and 'Remaining '.&lt;BR /&gt;
2) Show 'Used' and 'Remaining' in pie chart and add the Total value in the column labels.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2017 19:09:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-define-a-total-amount-of-a-Pie-Chart/m-p/344818#M102157</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-11-06T19:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: How can I define a total amount of a Pie Chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-define-a-total-amount-of-a-Pie-Chart/m-p/344819#M102158</link>
      <description>&lt;P&gt;WOOOOOOOW!&lt;BR /&gt;
Thank you so much! &lt;BR /&gt;
I can definitely work with this!&lt;BR /&gt;
Learned a lot (:&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2017 12:29:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-define-a-total-amount-of-a-Pie-Chart/m-p/344819#M102158</guid>
      <dc:creator>gcescatto</dc:creator>
      <dc:date>2017-11-07T12:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: How can I define a total amount of a Pie Chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-define-a-total-amount-of-a-Pie-Chart/m-p/344820#M102159</link>
      <description>&lt;P&gt;Anytime @gcescatto, we all learn everyday. Do think about Splunk Answers when you run into issues or want to help others &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2017 14:14:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-define-a-total-amount-of-a-Pie-Chart/m-p/344820#M102159</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-07T14:14:12Z</dc:date>
    </item>
  </channel>
</rss>

