我正在尝试在 Highcharts 的条形图中放置一个标签。在我的情况下,您可以在此处看到的每个栏上方:
$(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
}]
});
});
});`
我试过了,但是当我添加标签时,每个条都会出现一个标签。那么,这是怎么做到的?!