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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

alex-statsig
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants