bernii/gauge.js

Remove decimal separator

kamanlid opened this issue · 2 comments

Great work! thanks for sharing.

Is there a way to remove the decimal separator (thousands separator) from the values displayed?
The Gauge displays numbers above 1000 with separator even if the input value doesn't have it.

Thanks!

Hi, we have the same question here because we don't use this separator in french ;-)

Function would need to change.

The commas are added here.

gauge.js/dist/gauge.js

Lines 96 to 110 in 9ec4aca

addCommas = function(nStr) {
var rgx, x, x1, x2;
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = '';
if (x.length > 1) {
x2 = '.' + x[1];
}
rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
};