Dashboards & Visualizations

Rotate the data on bar chart value

Chamrong
Explorer

Hi Support

I have a bar chart. I can do the show value (Select Format > General > Show Data Values > On), but the value are shown as horizontal.

Is there a ways to show the data is vertical in the bar chart?
Regards

Tags (1)
0 Karma
1 Solution

cmerriman
Super Champion

from the docs, it doesn't look like you can rotate data labels.

http://docs.splunk.com/Documentation/SplunkCloud/6.6.3/Viz/ChartConfigurationReference#Bar_chart_pro...

if this is something you'd like developed, I'd submit an Enhancement Request with Support.

View solution in original post

0 Karma

michel_batista
New Member

Hi Guys,

I need the same thing, as we don't have this as a standard feature we can do it using javascript, however, this is for dashboards not reports.

Steps:

1) Add an ID for your chart editing the source
e.g:

2) create a javascript to update the labels and put them in vertical, of course, this is just an example you can customize by yourself,
Note: Keep the transform value and add the rotate for -90 or other value.

require([
         'jquery',
         'splunkjs/mvc',
         'splunkjs/mvc/simplexml/ready!'
     ], function($,mvc){
        var my_chart = mvc.Components.get("my_chart_id");

        if(my_chart != undefined){
         my_chart.getVisualization(function(chartView) {
             chartView.on("rendered", function() {

                $("#my_chart_id .highcharts-data-labels g").each(function(index){

                    //Used to rotate the label in 90º
                    var transformAttr = $(this).attr('transform');
                    //Avoid add the rotate more than one time
                    if(!transformAttr.includes('rotate'))
                        $(this).attr('transform', transformAttr + 'rotate(-90)');
                 });                


             });                     
         }); 
    }
});

3) Add the javascript reference in your dashboard,

alt text

0 Karma

cmerriman
Super Champion

from the docs, it doesn't look like you can rotate data labels.

http://docs.splunk.com/Documentation/SplunkCloud/6.6.3/Viz/ChartConfigurationReference#Bar_chart_pro...

if this is something you'd like developed, I'd submit an Enhancement Request with Support.

0 Karma
Get Updates on the Splunk Community!

Fall Into Learning with New Splunk Education Courses

Every month, Splunk Education releases new courses to help you branch out, strengthen your data science roots, ...

Super Optimize your Splunk Stats Searches: Unlocking the Power of tstats, TERM, and ...

By Martin Hettervik, Senior Consultant and Team Leader at Accelerate at Iver, Splunk MVPThe stats command is ...

How Splunk Observability Cloud Prevented a Major Payment Crisis in Minutes

Your bank's payment processing system is humming along during a busy afternoon, handling millions in hourly ...