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 showing in wrong position and with wrong data #10141

Closed
nicetomytyuk opened this issue Feb 7, 2022 · 3 comments · Fixed by #10046
Closed

Tooltip showing in wrong position and with wrong data #10141

nicetomytyuk opened this issue Feb 7, 2022 · 3 comments · Fixed by #10046

Comments

@nicetomytyuk
Copy link

nicetomytyuk commented Feb 7, 2022

Expected behavior

The tooltip should show dataset based on hovered position.

Current behavior

The tooltip is drawn in wrong dataset based on hover and it's data is not coherent with the dataset itself.

Reproducible sample

https://codepen.io/nicetomytyuk/pen/rNYjOrr

Optional extra steps/info to reproduce

In example chart try to hover 8:00 dataset, you will get in tooltip even 'NON RISCOSSO' which is not present in 8:00 dataset, if you try to hover on 9:00 green bar your tooltip will be drawn at 8:00 with wrong data, and same for other datasets.

Possible solution

No response

Context

No response

chart.js version

v3.7.0

Browser name and version

No response

Link to your project

No response

@etimberg
Copy link
Member

This is due to the use of 'index' mode for the tooltip which picks values based on the index in the dataset regardless of whether or not it matches the label. 'x' mode might be closer to what you want, but it won't show all the bars at once for a value.

@kurkle @LeeLenaleee I think we should consider a new interaction mode that works like 'x' but translates via the axis instead of using pixel coordinates. What do you think?

@etimberg etimberg added this to the Version 3.8.0 milestone Feb 12, 2022
@LeeLenaleee
Copy link
Collaborator

I think it would make working with object data a bit nicer, while you could add objects with null values it kind of defeats the purpose of the object notation.

@etimberg
Copy link
Member

Closing this in favour of #9961 and #9974 which are pretty much the same problem and there's a PR already started. I moved both of those other issues to the 3.8.0 milestone as well

@etimberg etimberg removed this from the Version 3.8.0 milestone Feb 12, 2022
@etimberg etimberg linked a pull request Feb 12, 2022 that will close this issue
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.

3 participants