-
Notifications
You must be signed in to change notification settings - Fork 473
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
Top of graph is cut off when values are specified as strings #841
Comments
This just sounds like a bug, maybe in the axis scaling code? If you have time to look into it, we've fixed a bunch of similar things recently if you look at the commit log. Otherwise I can try to find some time to take a peek next week. |
btw, a reproducible test case on jsfiddle using the latest version would be helpful, see for example #838 |
Here's a fiddle showing the problem. |
The problem here seems to be that you're specifying the values as strings, if I change the value https://jsfiddle.net/n5u2wwjg/7372/ That said, we should fix the axis scaling code to accept values passed in as strings (probably by trying to coerce them into numbers). |
It does, but if you remove the "" from all of the values in the fiddle, the labels display the numbers as integers - not decimals. Interestingly, here's another example where the values are represented as either numbers or strings. If you change one number to be an outlier, say 10.72, the values represented as strings show decimals correctly and the values represented as numbers are rounded. Either way, I don't think there's a work-around to using a method like .toFixed() to display decimals when using division (which returns a string). |
You might coincidentally get the behavior you expect some of the time with strings and that function, it depends on what you pass in. In the first example you posted, "8.72" resolves to be greater than "20.0" (as a string), so it gets classified as the maximum. It doesn't surprise me to hear that there are some issues with formatting values for display on the legend. Please file bugs for what you see and we can try to address them (@openjck has been filing some issues for some similar things, so maybe check the issues list first). |
Sure, I can file another bug. To be clear: you think the labels showing numbers being incorrectly rounded is unrelated to this original problem, which is the result of strings - rather than numbers - being provided (and the workaround in the meantime is not to use strings)? |
@sarah-clements I'm pretty sure that these are two seperate problems, yeah. #843 should fix the axis scaling issues when strings are passed in. |
Ok, thanks for looking into this! |
Is this related to #823? |
@openjck no that looks different, as we're seeing that bug when the values are specified as integers. |
Ok, after discussing this with @hamilton and @sarah-clements, I think what we really want is to fix #844 -- that was the motivation for using strings instead of numbers in the first place. Closing this one. |
This only happens if I use data with two decimals. The highest value for this example is 22.00. Is there a work-around for this?
The text was updated successfully, but these errors were encountered: