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

Chart does not properly update with animation in master #6104

Closed
emmcb opened this issue Mar 2, 2019 · 5 comments · Fixed by #6108
Closed

Chart does not properly update with animation in master #6104

emmcb opened this issue Mar 2, 2019 · 5 comments · Fixed by #6108
Milestone

Comments

@emmcb
Copy link
Contributor

emmcb commented Mar 2, 2019

Regression from #5331

I have a chart parameterized by a slider, so as the user is moving the slider, I repeatedly call update() on the chart to reflect the new parameter value in real time.

It is working well with version 2.7.3, but when testing with master, the chart does not update until the user stops moving the slider.

I found that this is a regression from #5331 which removes the drop frame mechanism. As the update() method is called nearly each frame, the animation start time is also reset each frame, and consequently the chart is updated each frame with an animation progress of zero.

The same bug appears on tooltip animation with a line chart configured like this:

tooltips: { mode: 'nearest', intersect: false }
As moving the mouse cursor on the chart:

  • In 2.7.3 the tooltip follows the cursor
  • In master the tooltip does not move until we stop moving the cursor
@emmcb emmcb added the type: bug label Mar 2, 2019
@emmcb emmcb changed the title Chart do not properly update with animation in master Chart does not properly update with animation in master Mar 2, 2019
@simonbrunel
Copy link
Member

@emmcbd can you please provide a codepen or jsfiddle that reproduces this issue? you can use https://chartjs.org/dist/master/Chart.min.js which is the latest build from master.

@emmcb
Copy link
Contributor Author

emmcb commented Mar 2, 2019

Here a reproduce case with tooltips, which is easier to reproduce:

master: https://codepen.io/anon/pen/pYyWbK
2.7.3: https://codepen.io/anon/pen/OqNOqY

Quickly move your mouse over the chart, you will see that the tooltip does not move (or with very jerky animation) until you stop moving.

If you switch back Chart.js to version 2.7.3, or revert #5331, everything is fine again.

@benmccann
Copy link
Contributor

@serhii-yakymuk you may want to be aware of this issue

@benmccann benmccann added this to the Version 2.8 milestone Mar 2, 2019
@serhii-yakymuk
Copy link
Contributor

@serhii-yakymuk you may want to be aware of this issue

Yes, thanks. I'll try to look into it.

@serhii-yakymuk
Copy link
Contributor

serhii-yakymuk commented Mar 2, 2019

@benmccann
I came to the same conclusion as @kurkle - bug is happening cause of currentStep being 0 all the time when animation is canceled quickly. If we keep currentStep in a range [1 ... numSteps] everything's working fine for me.

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

Successfully merging a pull request may close this issue.

4 participants