-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
cast getRightValue to number #5947
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only comment is that if we ever document the scale API, we should try and specify that getRightValue
returns a number so that we don't need to add in extras to do the conversion
Would changing |
Are we sure it will be always the case? can't we have string values displayed on a category scale? And what about date / time object data for time scale? The return type of Something we should consider in v3 is to move the stacking logic in the scale instead to have each controller to implement a generic method to stack values that works only with numbers. |
Thanks @kurkle |
1 + '0'
evaluates to'10'
, so stack calculation does not work correctly if values are strings.This was changed in #4565 where also linear scale was made to cast string to number.
However logarithmic scale uses implementation from
Scale
where that casting is not done (and can't be since its used for category scale as well)Wrong
size
calculation is fixed also per comment by @nagix in original PR.This calculated
size
(orcenter
) are currently not used for anything, so that part does not affect any tests.Fixes: #5862
Replaces: #5892
https://codepen.io/kurkle/pen/KrjXxL