Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to truncate trailing zero's #331

Open
mooleshacat opened this issue Aug 23, 2019 · 1 comment
Open

Option to truncate trailing zero's #331

mooleshacat opened this issue Aug 23, 2019 · 1 comment

Comments

@mooleshacat
Copy link

mooleshacat commented Aug 23, 2019

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

@deezone
Copy link
Contributor

deezone commented Dec 1, 2019

@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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants