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

Tooltip and hover options may be lost on update in beta 5 #8003

Closed
joshkel opened this issue Nov 4, 2020 · 1 comment · Fixed by #8006
Closed

Tooltip and hover options may be lost on update in beta 5 #8003

joshkel opened this issue Nov 4, 2020 · 1 comment · Fixed by #8006

Comments

@joshkel
Copy link
Contributor

joshkel commented Nov 4, 2020

Expected Behavior

Tooltip and hover modes should be preserved when reassigning chart options.

Current Behavior

After updating from Chart.js 3.0.0-beta.4 to beta 5, I noticed that my tooltips were no longer working. The problem appears to be the result of #7922; that PR adds logic to configure hover and tooltip options from a common set of interaction options, but that logic is only invoked on chart initialization, not on update. So, depending on how updates to the chart options are performed, the defaulted options can be lost.

(In my case, I'm using a home-grown Chart.js React component to do a wholesale replacement of the chart options object based on whatever options are passed as props to the React component.)

Possible Solution

Chart updates invoke the same interaction-merging logic as chart initialization, or tooltips and hover fall back to interaction when the options are actually used instead of merging interaction when they're initialized.

Steps to Reproduce

See https://codepen.io/joshkel/pen/VwjBwaa. Tooltips and hover work when the chart first loads, but clicking the Update button causes them to stop working.

Environment

  • Chart.js version: 3.0.0-beta.5
  • Browser name and version: Chrome 86.0.4240.183
@joshkel
Copy link
Contributor Author

joshkel commented Nov 4, 2020

Thanks!

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.

1 participant