jquery.sparkline
jquery.sparkline copied to clipboard
Formatting of values in the range -100 to -999 show an extra comma
See http://jsfiddle.net/gmathijssen/PfzXg/731/
Hoover over -105 and you will see -,105 instead of -105 This can be fixed in the formatNumber() function
+1
Same issue for -123123, -123123123 and any negative 3n-digit numbers.
Here is a fixed function:
formatNumber = function (num, prec, groupsize, groupsep, decsep) {
var p, i;
num = (prec === false ? parseFloat(num).toString() : num.toFixed(prec)).split('');
p = (p = $.inArray('.', num)) < 0 ? num.length : p;
if (p < num.length) {
num[p] = decsep;
}
shift = num[0] == '-' ? 1 : 0;
for (i = p - groupsize; i > shift; i -= groupsize) {
num.splice(i, 0, groupsep);
}
return num.join('');
};