-
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
Properly initialize variables if ticks aren't being displayed #6100
Conversation
Instead of "preventing" accessing a method ( |
I agree with @simonbrunel as well that we should fix the underlying issue as well. This works well as a stop-gap, but if we can ensure everything is correctly initialized that will prevent these errors in the future |
So currently there is no bug that needs to be fixed. I also agree that those properties used should be initialized, but currently its not critical (does not affect functionality in any way). I'd rather work out possible issues in a bit more substantial PR, like #5961 Edit: |
I agree with the suggested change of not calling I would maybe change these lines for: var w = (me.longestLabelWidth + padding) || 0;
//...
var h = (me._maxLabelLines * tickFont.lineHeight + padding) || 0; Though, I also agree it's not currently critical, just some code sanitation in case someone would like to use |
That was my initial suggestion to #6095 |
I've updated the code. I set |
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.
Seems quite solid to me now. If I'm right (and it was allowed), would also fixes _autoSkip
for vertical scale with rotate labels, by storing the longestLabelWidth
always.
Thanks @benmccann |
Closes #6095
_autoSkip
depends on_maxLabelLines
being defined which only occurs whentickOpts.display && display
as discussed in #6095This is also a performance improvement in the case that
!tickOpts.display