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!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...