<?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: help on complex bar chart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/help-on-complex-bar-chart/m-p/474036#M133367</link>
    <description>&lt;P&gt;@jip31, it is expected to be within the x-axis data label since the ticks on x-axis and y-axis is applied dynamically along with data labels. Since your x-axis labels are fixed you can definitely tweak the position of x-axis ticks/data label using CSS override (as per your actual panel width, monitor/browser resolution etc). However, I would suggest better leave it dynamic.&lt;/P&gt;

&lt;P&gt;For the average part seems like your logic happens in the macro &lt;CODE&gt;CPU&lt;/CODE&gt;, so for assisting you further we would need to look at the macro definition and possibly some raw sample data which is processed by the macro.&lt;/P&gt;</description>
    <pubDate>Fri, 21 Feb 2020 14:03:29 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2020-02-21T14:03:29Z</dc:date>
    <item>
      <title>help on complex bar chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-complex-bar-chart/m-p/474029#M133360</link>
      <description>&lt;P&gt;&lt;IMG src="https://community.splunk.com/storage/temp/283702-cpu.jpg" alt="alt text" /&gt;&lt;IMG src="https://community.splunk.com/storage/temp/283674-capture2.jpg" alt="alt text" /&gt;hi&lt;BR /&gt;
With the xml below, i display a complex bar chart that you can see in the screenshot&lt;BR /&gt;
I would like to modify 3 things :&lt;BR /&gt;
1 - I need to delete "Number" under the X axis&lt;BR /&gt;
2 - Under each bar of the chart I would like to have the scale that is actually in the legend&lt;BR /&gt;
Could you help me please?&lt;BR /&gt;
3- I need to do an average on process_cpu_used_percent field&lt;BR /&gt;
Something like :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | eval cpu_range=case(avg(process_cpu_used_percent&amp;gt;0 AND process_cpu_used_percent &amp;lt;=20,"0-20",



 &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;CPU overall usage&amp;lt;/title&amp;gt;
      &amp;lt;chart&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt; `CPU` 
| fields process_cpu_used_percent host 
| eval host=upper(host) 
| eval cpu_range=case(process_cpu_used_percent&amp;gt;0 AND process_cpu_used_percent &amp;lt;=20,"0-20",
    process_cpu_used_percent&amp;gt;20 AND process_cpu_used_percent &amp;lt;=40,"20-40",
    process_cpu_used_percent&amp;gt;40 AND process_cpu_used_percent &amp;lt;=60,"40-60",
    process_cpu_used_percent&amp;gt;60 AND process_cpu_used_percent &amp;lt;=80,"60-80",
    process_cpu_used_percent&amp;gt;80 AND process_cpu_used_percent &amp;lt;=100,"80-100") 
| chart dc(host) as "Number" by cpu_range 
| append 
    [| makeresults 
    | fields - _time 
    | eval cpu_range="0-20,20-40,40-60,60-80,80-100" 
    | makemv cpu_range delim="," 
    | mvexpand cpu_range 
    | eval "Number"=0] 
| dedup cpu_range 
| sort cpu_range 
| transpose header_field=cpu_range 
| search column!="_*" 
| rename column as cpu_range&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-7d@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="charting.axisTitleX.text"&amp;gt;CPU Usage (%)&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisTitleY.text"&amp;gt;Number of hosts&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.maximumNumber"&amp;gt;1000&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.chart"&amp;gt;column&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.stackMode"&amp;gt;default&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;{"0-20":0x49B849,"20-40":0x006EAA,"40-60":0xE0AC16,"60-80":0xDA742E,"80-100":0xC84535}&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.legend.placement"&amp;gt;right&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
      &amp;lt;/chart&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
  &amp;lt;row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:14:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-complex-bar-chart/m-p/474029#M133360</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-09-30T04:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: help on complex bar chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-complex-bar-chart/m-p/474030#M133361</link>
      <description>&lt;P&gt;Can you please attach the screenshot?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 07:24:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-complex-bar-chart/m-p/474030#M133361</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2020-02-19T07:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: help on complex bar chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-complex-bar-chart/m-p/474031#M133362</link>
      <description>&lt;P&gt;Here is sorry&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 09:06:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-complex-bar-chart/m-p/474031#M133362</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-02-19T09:06:26Z</dc:date>
    </item>
    <item>
      <title>Re: help on complex bar chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-complex-bar-chart/m-p/474032#M133363</link>
      <description>&lt;P&gt;Sample:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| fillnull a b c d e
| eval a=10, b=10,c=20,d=20,e=40,_time=substr(_time,1,4)
| rename _time as "Number Of Host", a as "0-20", b as "20-40", c as "40-60", d as "60-80", e as "80-100"
| table "Number Of Host" *
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="sample"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/8409i815A458216CE90E1/image-size/large?v=v2&amp;amp;px=999" role="button" title="sample" alt="sample" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 11:30:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-complex-bar-chart/m-p/474032#M133363</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-19T11:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: help on complex bar chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-complex-bar-chart/m-p/474033#M133364</link>
      <description>&lt;P&gt;it doesnt help me much more...&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 11:55:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-complex-bar-chart/m-p/474033#M133364</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-02-19T11:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: help on complex bar chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-complex-bar-chart/m-p/474034#M133365</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/102660"&gt;@jip31&lt;/a&gt; instead of &lt;CODE&gt;transpose&lt;/CODE&gt; use &lt;CODE&gt;eval{fieldname}&lt;/CODE&gt; expression after sort command in your current query. Try the following and confirm:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; `CPU` 
 | fields process_cpu_used_percent host 
 | eval host=upper(host) 
 | eval cpu_range=case(process_cpu_used_percent&amp;gt;0 AND process_cpu_used_percent &amp;lt;=20,"0-20",
     process_cpu_used_percent&amp;gt;20 AND process_cpu_used_percent &amp;lt;=40,"20-40",
     process_cpu_used_percent&amp;gt;40 AND process_cpu_used_percent &amp;lt;=60,"40-60",
     process_cpu_used_percent&amp;gt;60 AND process_cpu_used_percent &amp;lt;=80,"60-80",
     process_cpu_used_percent&amp;gt;80 AND process_cpu_used_percent &amp;lt;=100,"80-100") 
 | chart dc(host) as "Number" by cpu_range 
 | append 
     [| makeresults 
     | fields - _time 
     | eval cpu_range="0-20,20-40,40-60,60-80,80-100" 
     | makemv cpu_range delim="," 
     | mvexpand cpu_range 
     | eval "Number"=0] 
 | dedup cpu_range 
 | sort cpu_range 
 | fields cpu_range Number 
 | eval {cpu_range}=Number 
 | fields - Number
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For the 3rd point &lt;CODE&gt;3- I need to do an average on process_cpu_used_percent field&lt;/CODE&gt; you need to perform average on process_cpu_used_percent by which field?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:17:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-complex-bar-chart/m-p/474034#M133365</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-09-30T04:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: help on complex bar chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-complex-bar-chart/m-p/474035#M133366</link>
      <description>&lt;P&gt;thanks for the 2 first point&lt;BR /&gt;
the only thing is strange is that the X axis scale is not aligned in front of the bar chart. Is it normal?&lt;BR /&gt;
Or do i have to play with the bar char options?&lt;BR /&gt;
Concerning the last point, actually we count the number of host which have a process cpu used percent &amp;gt;0 and &amp;lt;20, &amp;gt;20 and &amp;lt;40.......&lt;BR /&gt;
It means that for a specific host we collect all process and that we count the process cpu used percent between 0 and 20 or 20 and 40 ...&lt;BR /&gt;
So I need that the count is based on the average of all process by host instead of all process by host&lt;BR /&gt;
the field relaed to the process is "process_name"&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2020 11:00:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-complex-bar-chart/m-p/474035#M133366</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-02-21T11:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: help on complex bar chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-complex-bar-chart/m-p/474036#M133367</link>
      <description>&lt;P&gt;@jip31, it is expected to be within the x-axis data label since the ticks on x-axis and y-axis is applied dynamically along with data labels. Since your x-axis labels are fixed you can definitely tweak the position of x-axis ticks/data label using CSS override (as per your actual panel width, monitor/browser resolution etc). However, I would suggest better leave it dynamic.&lt;/P&gt;

&lt;P&gt;For the average part seems like your logic happens in the macro &lt;CODE&gt;CPU&lt;/CODE&gt;, so for assisting you further we would need to look at the macro definition and possibly some raw sample data which is processed by the macro.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2020 14:03:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-complex-bar-chart/m-p/474036#M133367</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-02-21T14:03:29Z</dc:date>
    </item>
  </channel>
</rss>

