highcharts - Datalabel placement - Opposite of of chart data (positive and negative values) -
i'm creating bar chart positive , negative values , display xaxis (category name) of each data point (see fiddle: http://jsfiddle.net/engemasa/emjgg/).
here's have plot options i'm not sure else need (really putting code in here because need include code link jsfiddle)
plotoptions : { series : { datalabels: { formatter: function() { return this.x }, enabled: true } } },
i'm trying place label it's aligned start of each bar on chart. photoshoped desired result: http://i.imgur.com/0i1jshw.png
any appreciated.
you can iterate on each datalabel , use translate() function move svg element.
$.each(chart.series[0].data,function(i,data){ position = chart.yaxis[0].topixels(0); console.log(data); if(data.y < 0) position-=10; else position-=70; data.datalabel.attr({ x:position }); });
Comments
Post a Comment