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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...