-
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
Scales are measuring the longest text for all ticks including skipped… #5765
Conversation
… ticks This causes a decrease in performance.
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.
Here is a codepen that Alerts the time it takes to load the chart. The first alert is the time it takes without the modification, the second is with the scales prototype mutated to include my changes.
https://codepen.io/desean1625/pen/aRVpdj
At least on my browser
Chromium
Version 69.0.3497.81 (Official Build) Built on Ubuntu , running on Ubuntu 18.04 (64-bit)
it is almost 50% less time.
FF 62.0 (64-bit) Similar results.
@desean1625 will you be able to take another look at this PR in order to call |
I have not. I will see if I can get some time to look at this again. |
After having spent some time working on the surrounding code and looking at this more, I'm worried this approach won't work because Chart.js/src/core/core.scale.js Line 633 in 2cdb2f8
So we can't call |
As one potential optimization, we are going to stop measuring the label sizes when |
I spent awhile working on this code and talking to the other maintainers about it on Slack. They suggested that the expected order of operations is that we first rotate the ticks and then we do the auto-skipping. I think that this PR doesn't really fit that expectation, which I tried to better document here: #6079. If you look at some of the PRs and issues that are linked to that one you can see more of the discussion that was had and also look in the Slack #dev channel archives from around that date. One of the best ways to speed up your code is to use Chart.js 2.8.0 and set |
… ticks
This causes a decrease in performance.