Closed fdaudens closed 7 years ago
It think this will do what you need and change the code less
function round_to_precision(num, precision, supress_thou_sep) {
if (num === 0) {
//zero should always be "0"
return "0";
}
var s = Math.round(num * Math.pow(10,precision)) / Math.pow(10,precision);
s = s + "";
s = s.split(".");
if (s.length == 1) {
s[1] = "";
}
if (s[1].length < precision) {
s[1] += Array(precision-s[1].length + 1).join("0");
}
if (!supress_thou_sep) {
// add commas as thousands separator then swap it with a space
s[0] = d3.format(",")(parseInt(s[0])).split(",").join(" ");
}
if (precision === 0) {
return s[0];
}
// join the integer and decimal strings with a comma
return s.join(",");
}
oh sorry, i see the bug, fixing now
Thank you so much! It works perfectly.
Hi,
I'd like to use a comma for decimal separators in the Chart Grid renderer. Do you know which line I should modify?
I've already configured helper.js for the XYRenderer.jsx with the following code, but can't find what to change in ChartGridRenderer.jsk:
Thank you!