Skip to content

Chart does not properly update with animation in master #6104

Closed

Description

@emmcb

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

Activity

  1. changed the title [-]Chart do not properly update with animation in master[/-] [+]Chart does not properly update with animation in master[/+] on Mar 2, 2019
  2. simonbrunel commented on Mar 2, 2019

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

  3. emmcb commented on Mar 2, 2019

    @emmcb
    ContributorAuthor

    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.

  4. benmccann commented on Mar 2, 2019

    @benmccann
    Contributor

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

  5. added this to the Version 2.8 milestone on Mar 2, 2019
  6. serhii-yakymuk commented on Mar 2, 2019

    @serhii-yakymuk
    Contributor

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

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

  7. serhii-yakymuk commented on Mar 2, 2019

    @serhii-yakymuk
    Contributor

    @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions