-
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
controller.update always called twice #4865
Comments
Part of why this happens is for animations.
this only happens for newly added controllers (aka datasets). If the datasets do not change then this should be a no-op. We need to reset new controllers so that the first animation of those datasets has something to animate from. When a chart is created, we call update twice for every controller as they are all new. To make this faster, some optimizations are:
|
The part I'm worried about is that we calculate the location of every point, bar, etc. on the chart twice to show a static chart. Most of my charts have thousands of data points, so this seems like it could be a pretty substantial amount of extra work? |
@benmccann you're right. We can optimize away the reset if the chart is not animating. |
Could I just do something like this?
|
yup, that'll work :) |
In
src/core/core.controller.js:
we have some code that updates each controller twice. Both the call tohelpers.each
andupdateDatasets
below end up callingcontroller.update
on every controller.The source for
controller.reset
callscontroller.update
:And
updateDatasets
callsupdateDataset
which callscontroller.update
:So we end up calling
controller.update
twice in a row every time we update a chart, which seems like a fairly expensive operation to duplicate. I'm wondering if we can improve performance by removing one of these.The text was updated successfully, but these errors were encountered: