javascript - Styling the stacked column highchart datalabels individually -
i have been tasked individually style each 1 of highcharts' stacked barchart data labels: ones referring 3,2,5 in first chart, 4,2,3 in second , on. style these easy, seen in documentation/fiddle. how style them individually?
the fiddle has code styling of of them:
datalabels: { enabled: true, color: (highcharts.theme && highcharts.theme.datalabelscolor) || 'white', style: { textshadow: '0 0 3px black' } } here js fiddle per documentation: http://jsfiddle.net/3ak4ckuq/
set "usehtml: true" on datalabels. can access individual datalabel element of point , modify styles or add classes etc:
_.each(chart.series, function(serie) { _.each(serie.data, function(point) { var spanelement = point.datalabel.div.firstchild; spanelement.style.fontsize = _.sample(randomfontsizes); spanelement.style.color = _.sample(randomcolors); spanelement.classlist.add("custom-class"); }); }); see fiddle: http://jsfiddle.net/3ak4ckuq/6/
Comments
Post a Comment