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
Comments
unsubscribe
…________________________________
From: docmur ***@***.***>
Sent: Wednesday, 8 September 2021 8:02 AM
To: google/google-visualization-issues ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [google/google-visualization-issues] VAxis - Format Short - Wont render the numbers properly (#2927)
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
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#2927>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ANZ64GKCC76QKIVAWZGVMKTUA2DWTANCNFSM5DTIR2YA>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
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. |
@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. |
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). |
@dlaliberte - Setting a min of 0 fixed the issue! Thanks for that idea :) |
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
The text was updated successfully, but these errors were encountered: