Dashboards & Visualizations

Bar Chart Visualization

intern_jos
Engager

I would like to know if there is a way to display the total number of events at the top of the bar chart instead of using mouse over to see the exact number of events.

Thanks.

Tags (1)
0 Karma
1 Solution

MuS
SplunkTrust
SplunkTrust

Hi intern_jos,

Yes, you can enable this in the Visualization Format options:

alt text
and click on show data values. The result will be the values on the bars:

alt text

Hope this helps ...

cheers, MuS

View solution in original post

chimell
Motivator

Hi intern_jos
use these files if you work on splunk 6.2.x

1- xml code

<form script="custom_chart.js" stylesheet="custom_chart.css">
    <label>count by sourcetype</label>
   <fieldset autoRun="false" submitButton="false">

    <input type="time" token="tm" searchWhenChanged="true">
    <label>Select a time:</label>
    <default>All Time</default>
    </input>



  </fieldset>


  <row grouping="2">
        <html>
          <h2><strong>count by sourcetype</strong></h2>
            <div id="chart1" />
        </html>
        <table id="table1">
            <searchString>index=_internal |stats count by sourcetype</searchString>
            <earliestTime>$tm.earliest$</earliestTime>
            <latestTime>$tm.latest$</latestTime>
        </table>
    </row>


</form>

2- here is the js file

require([
    'underscore',
    'jquery',

    'splunkjs/mvc/utils',
    'splunkjs/mvc',
    'splunkjs/mvc/d3chart/d3chartview',
    'util/moment',
    'splunkjs/mvc/simplexml/ready!'
], function(_, $, utils, mvc, D3ChartView, moment) {

    // Re-use the search manager of the results table
    // var SearchManager = require("splunkjs/mvc/searchmanager");
     var tableManagerid1 = mvc.Components.get('table1').settings.get('managerid');
    // Create the D3 chart view
    var Barchart1 = new D3ChartView({
        "id": "chart1",
        "managerid": tableManagerid1,
        "type": "multiBarHorizontalChart",
        "drilldown": "full",
        "drilldownRedirect": false,
        "el": $('#chart1')
    }).render();

    Barchart1.settings.set("setup", function(chart) {
        // Configure chart formatting
        chart.color(d3.scale.category10().range())
        chart.showControls(true);
        chart.showValues(true); //Show bar value next to each bar.
        chart.tooltips(true);

    }); 

});

3- and the css file

#chart1
 {
    height: 450px;
}
0 Karma

MuS
SplunkTrust
SplunkTrust

Hi intern_jos,

Yes, you can enable this in the Visualization Format options:

alt text
and click on show data values. The result will be the values on the bars:

alt text

Hope this helps ...

cheers, MuS

intern_jos
Engager

Hi,

Thanks for this answer but sadly mine is Splunk 6.2 so does not have this function.
It would be great for Splunk 6.3 users!

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...