<?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 get Field Values to appear in Pie Chart? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-Field-Values-to-appear-in-Pie-Chart/m-p/502740#M32949</link>
    <description>&lt;P&gt;The changing of fieldColors to seriesColors as above worked perfectly. Thanks so much for your help Graham!&lt;/P&gt;</description>
    <pubDate>Fri, 18 Oct 2019 17:25:14 GMT</pubDate>
    <dc:creator>thisemailwillbe</dc:creator>
    <dc:date>2019-10-18T17:25:14Z</dc:date>
    <item>
      <title>How to get Field Values to appear in Pie Chart?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-Field-Values-to-appear-in-Pie-Chart/m-p/502734#M32943</link>
      <description>&lt;P&gt;I'm trying to get the number of the field to appear in the pie chart. Currently with the following search and XML change I can get the label and the percentage of the field but would like all three to appear. Here is my search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main source=mylog.log | chart latest(hardDriveUsed) as "Bytes Used" latest(hardDriveFree) as "Bytes Free" | transpose
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I also add the following for the percentage in the XML (intentional spaces added between &amp;lt; &amp;gt;):&lt;BR /&gt;
&amp;lt;    option name="charting.chart.showPercent" &amp;gt;true &amp;lt; /option &amp;gt;&lt;/P&gt;

&lt;P&gt;Any help would be greatly appreciated. Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2019 13:54:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-Field-Values-to-appear-in-Pie-Chart/m-p/502734#M32943</guid>
      <dc:creator>thisemailwillbe</dc:creator>
      <dc:date>2019-10-17T13:54:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Field Values to appear in Pie Chart?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-Field-Values-to-appear-in-Pie-Chart/m-p/502735#M32944</link>
      <description>&lt;P&gt;&lt;STRONG&gt;DiscIaimer:&lt;/STRONG&gt; I'm no Splunk expert. I was feeling guilty about asking so many questions here, so I thought I'd try to answer some, and I landed on yours. Lucky you! &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;The trick (kludge) I've used is to append the byte values to the labels:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval hardDriveUsed=100, hardDriveFree=200 | chart latest(hardDriveUsed) as "Used" latest(hardDriveFree) as "Free" | transpose column_name=Space | rename "row 1" as "Bytes" | eval Space = 'Space'." ".'Bytes'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That is, the &lt;CODE&gt;eval&lt;/CODE&gt; command replaces the values "Used" and "Free" with "Used 100" and "Free 200", respectively. (Unrealistically small byte values, I know. Sorry, I was in a hurry.)&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/7809iE70D5262E0B80555/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 don't blame you if you think this answer is too ugly to accept!&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2019 08:23:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-Field-Values-to-appear-in-Pie-Chart/m-p/502735#M32944</guid>
      <dc:creator>Graham_Hanningt</dc:creator>
      <dc:date>2019-10-18T08:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Field Values to appear in Pie Chart?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-Field-Values-to-appear-in-Pie-Chart/m-p/502736#M32945</link>
      <description>&lt;P&gt;Yes, I've seen the effect my answer has on the mouseover tooltip for each segment. However, given that you're already specifying &lt;CODE&gt;showPercent&lt;/CODE&gt;, I think it looks okay.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2019 08:29:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-Field-Values-to-appear-in-Pie-Chart/m-p/502736#M32945</guid>
      <dc:creator>Graham_Hanningt</dc:creator>
      <dc:date>2019-10-18T08:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Field Values to appear in Pie Chart?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-Field-Values-to-appear-in-Pie-Chart/m-p/502737#M32946</link>
      <description>&lt;P&gt;Just a thought: if the byte figures are big, you might want to show them in different units (here, megabytes):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval Space = 'Space'." ".tostring(round('Bytes'/pow(2,20),1))." MB"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Oct 2019 08:50:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-Field-Values-to-appear-in-Pie-Chart/m-p/502737#M32946</guid>
      <dc:creator>Graham_Hanningt</dc:creator>
      <dc:date>2019-10-18T08:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Field Values to appear in Pie Chart?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-Field-Values-to-appear-in-Pie-Chart/m-p/502738#M32947</link>
      <description>&lt;P&gt;So I made a couple of changes, and it works great! (one small problem though):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | makeresults | eval hardDriveUsed=hardDriveUsedField, hardDriveFree=hardDriveFreeField| chart latest(hardDriveUsed) as "Used" latest(hardDriveFree) as "Free" | transpose column_name=Space | rename "row 1" as "Bytes" | eval Space = tostring(round('Bytes'/pow(2,20),1)). GB"." ".'Space'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now my charting.fieldColors XML code doesn't work because I put the field values before the "Used" and "Available" &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt; option name="charting.fieldColors"&amp;gt;{"Available":0x77aaff,"Used":0xff0000}&amp;lt; /option &amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any ideas on how to fix this? Thanks again!&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2019 14:29:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-Field-Values-to-appear-in-Pie-Chart/m-p/502738#M32947</guid>
      <dc:creator>thisemailwillbe</dc:creator>
      <dc:date>2019-10-18T14:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Field Values to appear in Pie Chart?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-Field-Values-to-appear-in-Pie-Chart/m-p/502739#M32948</link>
      <description>&lt;P&gt;Given time, and if the following solution doesn't work reliably, then I might (possibly; I'm not certain) be able to define tokens that contain the adjusted field names, and refer to those tokens in the &lt;CODE&gt;&amp;lt;option&amp;gt;&lt;/CODE&gt;. Or I might just be dreaming; it's late here (I'm in Perth, Australia, UTC+8).&lt;/P&gt;

&lt;P&gt;Try replacing the &lt;CODE&gt;fieldColors&lt;/CODE&gt; option with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;option name="charting.seriesColors"&amp;gt;[0xff0000, 0x77aaff]&amp;lt;/option&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You might need to change the order of those colors, depending on the order of the fields in your search.&lt;/P&gt;

&lt;P&gt;I'm not certain that &lt;CODE&gt;seriesColors&lt;/CODE&gt;, even when given the same number of colors as corresponding fields in the search, always assigns colors in the same order. It might; I just don't know for sure. It would be helpful if the &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Viz/ChartConfigurationReference"&gt;Splunk docs&lt;/A&gt; were clearer on this specific point.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2019 15:27:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-Field-Values-to-appear-in-Pie-Chart/m-p/502739#M32948</guid>
      <dc:creator>Graham_Hanningt</dc:creator>
      <dc:date>2019-10-18T15:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Field Values to appear in Pie Chart?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-Field-Values-to-appear-in-Pie-Chart/m-p/502740#M32949</link>
      <description>&lt;P&gt;The changing of fieldColors to seriesColors as above worked perfectly. Thanks so much for your help Graham!&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2019 17:25:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-Field-Values-to-appear-in-Pie-Chart/m-p/502740#M32949</guid>
      <dc:creator>thisemailwillbe</dc:creator>
      <dc:date>2019-10-18T17:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Field Values to appear in Pie Chart?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-Field-Values-to-appear-in-Pie-Chart/m-p/502741#M32950</link>
      <description>&lt;P&gt;You're welcome! I'm glad I could help.&lt;/P&gt;

&lt;P&gt;Some final points:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;With apologies if you know this: you don't need to use the &lt;CODE&gt;makeresults | eval hard...&lt;/CODE&gt; commands that I used in my example search. I used those commands to dynamically generate data because I don't have your log. You don't need to use &lt;CODE&gt;makeresults&lt;/CODE&gt; with &lt;CODE&gt;eval&lt;/CODE&gt; to generate data; you have the data in your log.&lt;/LI&gt;
&lt;LI&gt;I notice you changed the &lt;CODE&gt;MB&lt;/CODE&gt; string in my example to &lt;CODE&gt;GB&lt;/CODE&gt;. To calculate &lt;EM&gt;gigabytes&lt;/EM&gt; from bytes, you need to divide the number of bytes by 2 to the power of 30: you need to change the &lt;CODE&gt;pow(2,20)&lt;/CODE&gt; function call to &lt;CODE&gt;pow(2,30)&lt;/CODE&gt;. (Guilty admission: in my original comment, which I edited shortly afterwards, I incorrectly used &lt;CODE&gt;pow(2,10)&lt;/CODE&gt; to convert bytes to megabytes. I did that because I was hastily copying'n'pasting from code that converted bytes to &lt;EM&gt;kilobytes&lt;/EM&gt;. Sorry if that misled you.)&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Fri, 18 Oct 2019 23:50:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-Field-Values-to-appear-in-Pie-Chart/m-p/502741#M32950</guid>
      <dc:creator>Graham_Hanningt</dc:creator>
      <dc:date>2019-10-18T23:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Field Values to appear in Pie Chart?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-Field-Values-to-appear-in-Pie-Chart/m-p/502742#M32951</link>
      <description>&lt;P&gt;I didn't use makeresults, I didn't even think that was a command, I was just assuming that you used that as a catch-all for my preceding code.&lt;/P&gt;

&lt;P&gt;Also I changed it to GB because it turns out that the code is outputting in kilobytes and not bytes hence the fact that the pow function wasn't changed.&lt;/P&gt;

&lt;P&gt;Thanks again for all your help!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2019 12:27:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-Field-Values-to-appear-in-Pie-Chart/m-p/502742#M32951</guid>
      <dc:creator>thisemailwillbe</dc:creator>
      <dc:date>2019-10-28T12:27:43Z</dc:date>
    </item>
  </channel>
</rss>

