Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HighCharts Place Label on Bar

Given the below image - I would like to take the label from the legend for each column and print it on the column itself. I have not been able to find anything in the HighCharts API that will allow me to do this. Does anyone have any ideas or examples of something like this I could look at?

Thank you!

HighChart Exampl

EDIT

There is a better example of what I want to accomplish

I think that is easily discernible. The use case is these stats are displayed on large monitors around a call center. The legend is typically too small to read from any given distance.

like image 586
Wjdavis5 Avatar asked Jul 17 '13 11:07

Wjdavis5


1 Answers

Just try formatting the data label on a column chart, here is an example to get you started.

 $(function () {
        $('#container').highcharts({
            chart: {
                type: 'column'
            },
            xAxis: {
                categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
            },

            plotOptions: {
                series: {
                    dataLabels: {
                        enabled: true,
                        color: '#000',
                        style: {fontWeight: 'bolder'},
                        formatter: function() {return this.x + ': ' + this.y},
                        inside: true,
                        rotation: 270
                    },
                    pointPadding: 0.1,
                    groupPadding: 0
                }
            },

            series: [{
                data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
            }]
        });
    });
like image 67
GGG Avatar answered Sep 23 '22 07:09

GGG