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.

http://jsfiddle.net/emjgg/7/

$.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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -