HighCharts legend.value and legend.percent items to 2 decimal points Math.Round() -
unfortunately how lengthy thing don't have fiddle it, didn't build it, trying assure these values set 2 decimal points, regardless of value of it. if it's 100, want read 100.00 , seemingly issue having. code section, replaces template value this;
if (islegend) { if (legendfootertemplate) { legendfooterdata = legendfootertemplate.replace("highcharts.value", addcommastolargenumber(math.round(totalvalues * 100) / 100)); legendfooterdata = legendfooterdata.replace("highcharts.percent", math.round(totalpercent)); legendtable.append("<tr>" + legendfooterdata + "</tr>"); } //make legend visible legendtable.css("visibility", "visible"); }
you can see adds commas larger numbers , takes formatted number , plugs template highcharts.value , highcharts.percent live. want know how can manipulate math.round() functions make have 2 decimal points no matter what. thank , help, nick g
for percentage use:
this.percentage.tofixed(2)
example: http://jsfiddle.net/jugal/dtmwp/
for other:
highcharts.numberformat(this.y,0)
example: http://jsfiddle.net/cakqh/24227/
Comments
Post a Comment