Skip to content
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

Remove unnecessary chart updates on drags #913

Merged
merged 3 commits into from
Feb 15, 2025

Conversation

alex-statsig
Copy link
Contributor

@alex-statsig alex-statsig commented Dec 14, 2024

Changes a few chart.update() calls in the zoom drag handler (i.e. mouse down, mouse move, mouse up) to just use chart.draw() instead. The chart update was unnecessary since none of the chart elements had updated. It is also much more expensive to update the chart (incurring costs of things like recomputing the ticks, recomputing any datapoint styling using chart context, etc.) than just to redraw the chart. In some cases with lots of datapoints, this speeds up the function from 100ms -> 1ms. As far as I can tell, the only purpose of the chart.update() call was to repaint the shaded area being zoomed, but chart.draw() achieves the same purpose.

@NotTsunami
Copy link

@kurkle Would be nice to see this one move along

@alex-statsig
Copy link
Contributor Author

Anything I can do to help get this merged?

@kurkle kurkle merged commit 137d924 into chartjs:master Feb 15, 2025
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants