toorshia/justgage

Option to truncate trailing zero's

mooleshacat opened this issue · 1 comments

I would like it to chop off leading zeros but only when the decimals are all zeros - but with an option true/false to do so as some may not like it.

What I mean:

Value = 100.00 then show only 100
Value = 265.50 then show only 265.50
Value = 134.36 then show only 134.36
Value = 23.45 then show only 23.45

I am looking for a way in meantime to hack it.

Thanks

@leshacat

An easier solution would be to do the formatting before you submit it to the gage. Something like:

let value = 1.00;
value.toString();
Number(value);

// value is now 1

versus

let value = 1.0001;
value.toString();
Number(value);

// value is now 1.0001

follow with sending it to the gage.

gauge.refresh(value);