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 Temporarily Combines data with mode:"x" and intersect:false #8293

Closed
mclean25 opened this issue Jan 10, 2021 · 16 comments
Closed

Tooltip Temporarily Combines data with mode:"x" and intersect:false #8293

mclean25 opened this issue Jan 10, 2021 · 16 comments

Comments

@mclean25
Copy link

Expected Behavior

Tooltip should show the current axis intersect data correctly without what I can only describe as "render glitches".

Current Behavior

When moving your mouse over the x-axis, you can see that the tooltip will "flutter" at some points, showing data as if there's 3 or 4 datasets instead of just 2. They only last for a short duration, and then fade away on the next render loop.

Possible Solution

Seems like something to do with how the intersect is being fetched is returning the wrong (or combined) result for some reason. Also note that there seems to be a related bug when you turn animations on in options.hover (I turned them off). The issue seems to get much, much worse.

Steps to Reproduce

https://jsfiddle.net/mclean25/0hdzsftk/15/

Context

It would be a very big UX improvement if the tooltip were to render nicely instead of looking like something breaks temporarily.

Environment

  • Chart.js version: 2.9.4
  • Browser name and version: Version 87.0.4280.141 (Official Build) (x86_64)
@mclean25
Copy link
Author

Here's an example of what it looks like when the data get's stacked. The 15k & 15.39k values should be there, but the other two are added for some reason. The other two values seem to come from 2021-02-24 (instead of the desired date here of 2021-02-08.

image

@LeeLenaleee
Copy link
Collaborator

LeeLenaleee commented Jan 10, 2021

You can set the mode to index to get the result you want for the time being.

@kurkle
Copy link
Member

kurkle commented Jan 10, 2021

Reproduces in master:
image

@mclean25
Copy link
Author

As @LeeLenaleee stated, setting the mode to index instead of x solved my issue.

@LeeLenaleee
Copy link
Collaborator

Guess the issue should still be open since it is still definitly a bugg because it should only show the items intersecting on that X value and now it shows more items

@mclean25 mclean25 reopened this Jan 10, 2021
@etimberg
Copy link
Member

I'm guessing that this is due to the points being very close together and multiple points returning positive hit-tests.

@kurkle
Copy link
Member

kurkle commented Mar 2, 2021

Also fixed by setting pointHitRadius: 0:
https://jsfiddle.net/ae5vrcfL/

I'm closing as this is working as expected, the points should return positive hit-test with those parameters.

@kurkle kurkle closed this as completed Mar 2, 2021
@JEK58
Copy link

JEK58 commented Mar 18, 2021

With beta V3-beta-13 it does not a show any tooltip with pointHitRadius: 0.
Any idea how to make it work again?

Setting the mode to index instead of x doesn't work for me as the datasets do not start at the same time. (X axis is time based)

@kurkle
Copy link
Member

kurkle commented Mar 18, 2021

intersect: false? if that does not work, we'd need a fiddle to take a look.

@JEK58
Copy link

JEK58 commented Mar 19, 2021

intersect was set to false, yes. I set up a fiddle: https://jsfiddle.net/JEK58/at4w6j5z/

@JEK58
Copy link

JEK58 commented Apr 24, 2021

Any idea? I'm still having this issue with the latest release (3.2.0)

@kurkle
Copy link
Member

kurkle commented Apr 25, 2021

@JEK58 are you looking for something like that: https://jsfiddle.net/svt7g0rn/ ?

@JEK58
Copy link

JEK58 commented Apr 25, 2021

@kurkle almost. I would like to see the altitude of both pilots at the same time.

@kurkle
Copy link
Member

kurkle commented Apr 25, 2021

@JEK58 your point skipping skipped different points so there were not many at the same timestamps.

Without the skipping (and some other tuning): https://jsfiddle.net/svt7g0rn/5/

@silvester-pari
Copy link

@kurkle unfortunately, even with pointHitRadius: 0, this still happens with chartjs ^3.6.2 if the points are close enough to each other. Hovering highlights at least points from two dates which is quite annoying.

With pointHitRadius: 1:
image

With pointHitRadius: 0:
image

Isn't there any way to only hover at "exact" x value? Mode index doesn't seem to have this issue, but only works if both datasets have the same amount of points (which does not happen with time axes).

@kurkle
Copy link
Member

kurkle commented Dec 21, 2021

#9974 (or #9961) would solve the issue.

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

6 participants