I have a Highcharts graph that has data labels enabled. By default, the data labels are attached to the end of each data bar (see this fiddle: http://jsfiddle.net/cyphun/NHCvW).
Is it possible to move the negative data labels and display them next to the x-axis instead of the end of the bar? Here is a doctored screen shot of what I would like to do:
http://cl.ly/image/2G3F0I2l2m1z
Here is a copy of my Highcharts example code:
$(function () {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'column'
},
plotOptions: {
column: {
dataLabels: {
enabled: true,
useHTML: true,
style: {
color: '#252525',
fontWeight: 'bold'
}
}
}
},
title: {
text: 'Column chart with negative values'
},
xAxis: {
categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
},
tooltip: {
formatter: function() {
return ''+
this.series.name +': '+ this.y +'';
}
},
credits: {
enabled: false
},
series: [{
name: 'Jane',
data: [2, -2, -3, 2, 1]
}]
});
});
});
Thanks for the help!
You can achieve this by using stackLabels and doing some trick with setting y (position y) attribute of dataLabels. Also you should set verticalAlign of dataLabels to ‘top’.
Demo: http://jsfiddle.net/NHCvW/49/