Reputation: 39
chart: {
type: 'column'
},
xAxis: {
type: 'category'
},
plotOptions: {
series: {
dataLabels: {
enabled: true,
formatter: function () {
return '<b >'+Math.round(this.point.y)+'%</b>'+'<br>
<b >(N='+ this.point.count + ')</b>';
}
}
}
}
I want to display 5%,1%,0% in the center of the column/center above (N=600)
Here is jsfiddle
Upvotes: 1
Views: 243
Reputation: 139
Based on Rockie Yang's code, I found that you need to add the exporting property allowHTML and make it true. It's false by default and allowHTML allows you to preserve HTML structure in the exported chart.
JSFiddle: http://jsfiddle.net/henrikskar/oos3bqov/
exporting: {
enabled: true,
allowHTML: true
}
Upvotes: 2
Reputation: 4925
Add useHTML and center the element.
Ref Highcharts Labels and String Formatting
dataLabels: {
enabled: true,
useHTML: true,
formatter: function () {
return '<center><b>'+Math.round(this.point.y)+'%</b></center>'
+'<br><center><b>(N='+ this.point.count + ')</b><center>';
}
if you wanna exporting, then add following allowHTML in exporting.
exporting: {
allowHTML: true
}
Upvotes: 3