gauge.js
gauge.js copied to clipboard
Missing Number() conversion in function formatNumber()
I've been experiencing some issues when creating a Gauge, and after messing around a little I found that the problem was on the function formatNumber(), i.e.:
formatNumber = function() {
var digits, num, value;
num = 1 <= arguments.length ? slice.call(arguments, 0) : [];
value = num[0];
digits = 0 || num[1];
return addCommas(value.toFixed(digits));
};
The solution I found is to change
value = num[0]
to value = Number(num[0])
Otherwise I wasn't able to create the Gauge properly when num[0] was something like "7" (as a string) instead of 7 (as a number).
Thanks!