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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...