unfortunately with how lengthy this thing is I don't have a fiddle for it, as I didn't build it, but basically all I am trying to do is assure that these values get set to two decimal points, regardless of the value of it. If it's 100, I want it to read 100.00 and that is seemingly the issue I am having. The code for this section, which replaces a template value is 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 the legend visible
legendTable.css("visibility", "visible");
}
you can see it adds commas to larger numbers and takes that formatted number and plugs it into the template where highcharts.value and highcharts.percent live. I just want to know how I can manipulate the math.round() functions to make it have two decimal points no matter what. Thank you for any and all 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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With