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 seems to be updated twice in a row #6557

Closed
aldipower opened this issue Oct 6, 2019 · 5 comments
Closed

Chart seems to be updated twice in a row #6557

aldipower opened this issue Oct 6, 2019 · 5 comments

Comments

@aldipower
Copy link

I just noticed that all hooks in my self written plugins and all axis callbacks are called twice,
so I presume the chart is running it's update and drawing cycle twice somehow.
Is this maybe expected behavior?

I measured from beforeUpdate to afterUpdate and this needs ~15ms. Running twice this is 30ms. On some pages I have 5 charts. 150ms is already very noticeable.

Expected Behavior

Run the chart drawing/update cycle only once.

Current Behavior

The chart cycle is running twice. All hooks and callbacks are called twice.

Steps to Reproduce (for bugs)

  • I turned off animations. duration: 0
  • Chart is only instantiated once.
  • canvas-element is only rendered once.
  • Data is not changed in the meantime nor mutated.
  • Chart is just freshly created, never updateed.
@aldipower aldipower changed the title Chart seems to be updated twice Chart seems to be updated twice in a row Oct 6, 2019
@benmccann
Copy link
Contributor

The axis may be updated twice in 2.8.0 and earlier in order to size the various chart components. In master it has been fixed so that this happens far less often. Can you check if the code in master fixes your issue?

@aldipower
Copy link
Author

aldipower commented Oct 7, 2019

Thank you, I've checked out master and the issue is not there anymore. Every hook is only called once. Fixed here then. :) Great great great. 👍


But now I have small problem, I am stuck with 2.7.3, because I always need the last tick to be displayed, which isn't working in 2.8.0 anymore due to breaking changes.
#6154
Any plans to add that option in the near future?

Could you point me to the fix of the double rendering prevention, so I could try to bring this into a internal 2.7.3 fork?

I am also willing to help with the 6154 issue somehow, if you don't mind.

EDIT:
Ok, it's maybe easier to remove the changes from #5891 here, than to add the double render fix to an old code base.

@benmccann
Copy link
Contributor

The change with the fix was #6304

One of the main reasons the autoskip behavior was reverted was because it caused the ticks to no longer be evenly spaced and would cause a large gap at the end of the axis. I'm curious what your use case is. I'd like to learn more about the reasons users want to always show the last tick as it may help us in designing new solutions.

@aldipower
Copy link
Author

Thanx a lot.

I've described my use case here not be off-topic:
#6154 (comment)

@benmccann
Copy link
Contributor

Ok. I will close this issue then since the twice in a row issue is solved

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

No branches or pull requests

2 participants