<?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 make a stacked bar chart not display zeros? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-make-a-stacked-bar-chart-not-display-zeros/m-p/429560#M28297</link>
    <description>&lt;P&gt;Ideally you can just navigate and put it under the specific folder where Splunk is installed under your app's folder.&lt;/P&gt;

&lt;P&gt;If you want to do it from UI, you can navigate to &lt;CODE&gt;Apps --&amp;gt; Manage App&lt;/CODE&gt; or directly from URL &lt;CODE&gt;&lt;A href="http://&amp;lt;yourSplunkURL&amp;gt;/en-US/manager/search/apps/local" target="test_blank"&gt;http://&amp;lt;yourSplunkURL&amp;gt;/en-US/manager/search/apps/local&lt;/A&gt;&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Then Find your App and Click &lt;CODE&gt;Edit Properties&lt;/CODE&gt; to navigate to App's Edit page. Choose &lt;CODE&gt;Upload Asset&lt;/CODE&gt; and click on the JavaScript File to be uploaded to your App's Appserver static folder.&lt;/P&gt;

&lt;P&gt;In order to test you can type in the following URL, which will show the uploaded JavaScript file code in the Browser or else throw 404 error if file is missing:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&lt;A href="http://&amp;lt;yourSplunkURL&amp;gt;/en-US/static/app/&amp;lt;yourAppName&amp;gt;/&amp;lt;yourJSFile&amp;gt;.js" target="test_blank"&gt;http://&amp;lt;yourSplunkURL&amp;gt;/en-US/static/app/&amp;lt;yourAppName&amp;gt;/&amp;lt;yourJSFile&amp;gt;.js&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 29 May 2018 16:14:58 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2018-05-29T16:14:58Z</dc:date>
    <item>
      <title>How can I make a stacked bar chart not display zeros?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-make-a-stacked-bar-chart-not-display-zeros/m-p/429555#M28292</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;If I have a stacked bar graph and I want to display two types of values for each one, how can I make the null (0) values not be displayed like below?&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/5091iDF130ED9EEFEBD5F/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;Thanks, &lt;BR /&gt;
Sam&lt;/P&gt;</description>
      <pubDate>Tue, 29 May 2018 12:50:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-make-a-stacked-bar-chart-not-display-zeros/m-p/429555#M28292</guid>
      <dc:creator>samwatson45</dc:creator>
      <dc:date>2018-05-29T12:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make a stacked bar chart not display zeros?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-make-a-stacked-bar-chart-not-display-zeros/m-p/429556#M28293</link>
      <description>&lt;P&gt;What's you query generating this graph? If one of the value is null/0, do you want to completely eliminate whole set of data for that month?&lt;/P&gt;</description>
      <pubDate>Tue, 29 May 2018 15:08:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-make-a-stacked-bar-chart-not-display-zeros/m-p/429556#M28293</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-05-29T15:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make a stacked bar chart not display zeros?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-make-a-stacked-bar-chart-not-display-zeros/m-p/429557#M28294</link>
      <description>&lt;P&gt;@samwatson45, I am on Splunk 7.1 and I tried to mimic 0 in Stacked Chart using Timechart and Chart commands. But 0 Data Label shows up only when &lt;CODE&gt;Min/Max&lt;/CODE&gt; is used. &lt;CODE&gt;0&lt;/CODE&gt; does not show up in 7.1 as data label when &lt;CODE&gt;Show All&lt;/CODE&gt; option is used (refer to the screenshot below from 7.1). &lt;/P&gt;

&lt;P&gt;Since you are on an older version I have the following example using &lt;CODE&gt;Simple XML JS Extension&lt;/CODE&gt; and &lt;CODE&gt;SplunkJS Stack&lt;/CODE&gt; to hide Data Label from ChartView  based on condition (in your case it will be &lt;CODE&gt;0&lt;/CODE&gt;, in the example below it is &lt;CODE&gt;1&lt;/CODE&gt;). Please try out and confirm. &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;This same Example can be extended to hide Data Labels in specific range as well.&lt;/STRONG&gt;&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/5090i42BAB0BDB31D7C76/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;Following is the code for Simple XML Dashboard:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard script="hide_stacked_chart_datalabel_based_on_value.js"&amp;gt;
  &amp;lt;label&amp;gt;Stacked Chart Hide Data Label Based On Value&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;chart id="myChart"&amp;gt;
        &amp;lt;title&amp;gt;Table with jQuery Selector to Hide Data Label (Example Uses Data Label Value=1)&amp;lt;/title&amp;gt;
        &amp;lt;search id="baseSearchTimeChart"&amp;gt;
          &amp;lt;query&amp;gt;index=_internal sourcetype=splunkd log_level!="INFO"
| bin span=1h _time
| eval Time=strftime(_time,"%H").":00"
| chart count by Time log_level&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="height"&amp;gt;400&amp;lt;/option&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;-45&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;column&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;all&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;stacked&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;panel&amp;gt;
      &amp;lt;chart id="myChartWithoutJqueryToHideDataLabels"&amp;gt;
        &amp;lt;title&amp;gt;Table without jQuery Selector to Hide Data Label&amp;lt;/title&amp;gt;
        &amp;lt;search base="baseSearchTimeChart"&amp;gt;
          &amp;lt;query&amp;gt;&amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="height"&amp;gt;400&amp;lt;/option&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;-45&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;column&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;all&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;stacked&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;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table &amp;gt;
        &amp;lt;title&amp;gt;Table without jQuery Selector to Hide Data Label&amp;lt;/title&amp;gt;
        &amp;lt;search base="baseSearchTimeChart"&amp;gt;
          &amp;lt;query&amp;gt;&amp;lt;/query&amp;gt;
        &amp;lt;/search&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;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;  
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Following is the JavaScript Code for &lt;CODE&gt;hide_stacked_chart_datalabel_based_on_value.js&lt;/CODE&gt;. The script file needs to be placed under &lt;CODE&gt;appserver/static&lt;/CODE&gt; folder i.e. (if the folder &lt;CODE&gt;appserver/static&lt;/CODE&gt;does not exist, the same would need to be created: &lt;CODE&gt;$SPLUNK_HOME/etc/apps/&amp;lt;yourSplunkAppName&amp;gt;/appserver/static.&lt;/CODE&gt; Following example hides 1 from Data Label but the same can be changed to 0 or any other value or range to hide data labels accordingly by changing the condition &lt;CODE&gt;strDataLabel == "1"&lt;/CODE&gt;. (For simplicity sake I have kept as string but the same can be converted to Int/Float as required)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
    "splunkjs/mvc",
    "splunkjs/mvc/chartview",
    "splunkjs/mvc/simplexml/ready!"
], function (
    mvc
) {
        //Get Single Value by id=singleValueWithMouseover set in SimpleXML &amp;lt;single id="singleValueWithMouseover"&amp;gt;
        mvc.Components.get('myChart').getVisualization(function (chartView) {
            chartView.on('rendered', function () {
                // Select highcharts data labels with 0 value #myChart svg g.highcharts-data-labels g.highcharts-label text tspan
                $("#myChart svg g.highcharts-data-labels g.highcharts-label text tspan").each(function () {
                    //Iterate through each data label. Access through "$(this)" selector
                    var strDataLabel = $(this).text();
                    if (strDataLabel == "1") {
                        console.log("Hiding Unwanted Data Label");
                        $(this).hide();
                    };
                });
            });
        });
    });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;PS: Since this example involves static JS file, it would require restart/refresh or bump of your Splunk instance and may need you to clear internet browser history for the changes to reflect.&lt;/P&gt;</description>
      <pubDate>Tue, 29 May 2018 15:24:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-make-a-stacked-bar-chart-not-display-zeros/m-p/429557#M28294</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-05-29T15:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make a stacked bar chart not display zeros?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-make-a-stacked-bar-chart-not-display-zeros/m-p/429558#M28295</link>
      <description>&lt;P&gt;Thanks for your reply!&lt;/P&gt;

&lt;P&gt;When you say the script needs to be placed in a folder, where do I go within the Splunk window to access this?&lt;/P&gt;

&lt;P&gt;Thanks, &lt;BR /&gt;
Sam&lt;/P&gt;</description>
      <pubDate>Tue, 29 May 2018 15:47:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-make-a-stacked-bar-chart-not-display-zeros/m-p/429558#M28295</guid>
      <dc:creator>samwatson45</dc:creator>
      <dc:date>2018-05-29T15:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make a stacked bar chart not display zeros?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-make-a-stacked-bar-chart-not-display-zeros/m-p/429559#M28296</link>
      <description>&lt;P&gt;The query is a bit odd, I am essentially using a manually uploaded csv to calculate the number of hours spent at certain locations for each month.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup  file.csv   | eval hours=mondayhours + tuesdayhours+ wednesdayhours + thursdayhours + fridayhours+ saturdayhours + sundayhours | eval date=substr(date,4,len(date)-0) | chart sum(hours) by date, location | rename date AS "Month"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 May 2018 15:56:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-make-a-stacked-bar-chart-not-display-zeros/m-p/429559#M28296</guid>
      <dc:creator>samwatson45</dc:creator>
      <dc:date>2018-05-29T15:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make a stacked bar chart not display zeros?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-make-a-stacked-bar-chart-not-display-zeros/m-p/429560#M28297</link>
      <description>&lt;P&gt;Ideally you can just navigate and put it under the specific folder where Splunk is installed under your app's folder.&lt;/P&gt;

&lt;P&gt;If you want to do it from UI, you can navigate to &lt;CODE&gt;Apps --&amp;gt; Manage App&lt;/CODE&gt; or directly from URL &lt;CODE&gt;&lt;A href="http://&amp;lt;yourSplunkURL&amp;gt;/en-US/manager/search/apps/local" target="test_blank"&gt;http://&amp;lt;yourSplunkURL&amp;gt;/en-US/manager/search/apps/local&lt;/A&gt;&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Then Find your App and Click &lt;CODE&gt;Edit Properties&lt;/CODE&gt; to navigate to App's Edit page. Choose &lt;CODE&gt;Upload Asset&lt;/CODE&gt; and click on the JavaScript File to be uploaded to your App's Appserver static folder.&lt;/P&gt;

&lt;P&gt;In order to test you can type in the following URL, which will show the uploaded JavaScript file code in the Browser or else throw 404 error if file is missing:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&lt;A href="http://&amp;lt;yourSplunkURL&amp;gt;/en-US/static/app/&amp;lt;yourAppName&amp;gt;/&amp;lt;yourJSFile&amp;gt;.js" target="test_blank"&gt;http://&amp;lt;yourSplunkURL&amp;gt;/en-US/static/app/&amp;lt;yourAppName&amp;gt;/&amp;lt;yourJSFile&amp;gt;.js&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 May 2018 16:14:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-make-a-stacked-bar-chart-not-display-zeros/m-p/429560#M28297</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-05-29T16:14:58Z</dc:date>
    </item>
  </channel>
</rss>

