-
Notifications
You must be signed in to change notification settings - Fork 12k
Description
Hi Nick,
First of all, congrats about your awesome Chart library.
I have come across an issue about decimals and the series labels. It raises an exception when the format is exponential (like "5-e7"), because it doesn´t contains a ".".
I have fixed this so here is the code if you want to include it:
Line #1374:
function getDecimalPlaces(num) {
var numberOfDecimalPlaces;
if (num % 1 != 0) {
var s = num.toString();
var idx = s.indexOf("e-");
if (idx > 0) {
var s2 = s.substring(0, idx - 1);
var exp = parseInt(s.substr(idx + 2, s.length - 1),10);
if (s2.indexOf(".") > 0)
exp -= s2.split(".")[0].length;
s2 = s2.replace(".", "");
var result = "0.";
for (var i = 0; i < parseInt(exp, 10);i++) {
result += "0";
}
result += s2;
return result.split(".")[1].length;
}
else
return num.toString().split(".")[1].length;
}
else {
return 0;
}
}
Awesome library again!