Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
52
rated 0 times [  59] [ 7]  / answers: 1 / hits: 21866  / 11 Years ago, tue, march 26, 2013, 12:00:00

I'm trying to put a label within a bar chart in Highcharts. In my case above each bar which you can see here:



$(function () {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({

chart: {
renderTo: 'container',
type: 'column'
},

title: {
text: 'Indicator per Sex'
},

xAxis: {
categories: [
'Jan',
'Fev',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dez'
]
},

yAxis: {
allowDecimals: false,
min: 0,
title: {
text: 'Consults'
}
},

tooltip: {
formatter: function() {
return '<b>'+ this.x +'</b><br/>'+
this.series.name +': '+ this.y +'<br/>'+
'Total: '+ this.point.stackTotal;
}
},

plotOptions: {
column: {
stacking: 'normal'
}
},

series: [
{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 29.9, 71.5, 106.4, 129.2, 144.0, 10, 20],
color: '#FF0011',
stack: 0
}, {
data: [30, 176.0, 135.6, 148.5, 216.4, 29.9, 71.5, 106.4, 129.2, 144.0, 10, 20],
color: '#3333FF',
stack: 0
}, {
data: [29.9, 71.5, 106.4, 129.2, 144.0, 29.9, 71.5, 106.4, 129.2, 144.0, 10, 20],
color: '#FF0011',
stack: 1
}, {
data: [30, 176.0, 135.6, 148.5, 216.4, 29.9, 71.5, 106.4, 129.2, 144.0, 10, 20],
color: '#3333FF',
stack: 1
}, {
data: [29.9, 71.5, 106.4, 129.2, 144.0, 29.9, 71.5, 106.4, 129.2, 144.0, 10, 20],
color: '#FF0011',
stack: 2
}, {
data: [30, 176.0, 135.6, 148.5, 216.4, 29.9, 71.5, 106.4, 129.2, 144.0, 10, 20],
color: '#3333FF',
stack: 2
}]
});
});
});`


I tried, but when I add labels appear one label each bar. So, how do this?!


More From » jquery

 Answers
25

Highcharts stackLabels will do the work.
See here


[#79342] Monday, March 25, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
prestonh

Total Points: 384
Total Questions: 105
Total Answers: 105

Location: England
Member since Tue, Sep 8, 2020
4 Years ago
;