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

VAxis - Format Short - Wont render the numbers properly #2927

Open
docmur opened this issue Sep 7, 2021 · 5 comments
Open

VAxis - Format Short - Wont render the numbers properly #2927

docmur opened this issue Sep 7, 2021 · 5 comments

Comments

@docmur
Copy link

docmur commented Sep 7, 2021

Good Day

See the code sample here: https://jsfiddle.net/majd80bn/29/

I have format: 'short' clearly set for the vAxes, and it appears that unless the number can round easily it won't truncate it for the label. 1 890 123 456.9 should render as 1.8, 1.9 or 1.89 B, ignoring the 0123456.9 behind it, and if you make 123 456 -> 000 000 then it will show the value correctly.

Is there a way around this issue? I won't know what the data until it's passed from a BE, and if I round the data before I pass it to the chart parsing function then I'll lose the accuracy on hover, which I want to maintain.

Is this a solution for this behavior?

Cheers

@rob837428394
Copy link

rob837428394 commented Sep 8, 2021 via email

@dlaliberte
Copy link
Collaborator

The problem involves the fact that you have only one data point. I'm not sure exactly why it is a problem in this case, but there are often weird cases involving a single data point. I added a second row to your data, in https://jsfiddle.net/dlaliberte/wjt7u8y6/2/, and it appears to format the values correctly.

@docmur
Copy link
Author

docmur commented Sep 8, 2021

@dberlin - Thanks, but I can't guarantee they'll be a second data point, it's possible for the data to categorize under single points, exactly like I showed. Is it possible to add a data point and mark it to not be drawn or rendered? Then I can throw in a junk point for this case and just ignore it.

@dlaliberte
Copy link
Collaborator

You can set the minValue for your vAxes to be 0, then it will act like it has two values, and this may be reasonable for your column chart anyway, since it will otherwise not include 0 (which is an unfortunate legacy feature).

@docmur
Copy link
Author

docmur commented Sep 9, 2021

@dlaliberte - Setting a min of 0 fixed the issue! Thanks for that idea :)

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

3 participants