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!

Splunk Observability Cloud's AI Assistant in Action Series: Auditing Compliance and ...

This is the third post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

What You Read The Most: Splunk Lantern’s Most Popular Articles!

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...