-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Display tooltip for only one item per dataset at a time #5578
Display tooltip for only one item per dataset at a time #5578
Conversation
I have the same problem |
Is there ever a case where you would not want this behavior? I'm wondering if it should at least be the default or if it should always happen without an option. @etimberg @simonbrunel thoughts? Also, this would need documentation and a test |
You're right, I think it should be the default behavior. I'll make it default and add documentation and test. |
@benmccann good point and I agree: if it's a bug, we should not introduce any option, else, if it's a feature, we should not change the default behavior since it would be a breaking change in projects relying on multiple values per dataset. I don't know if there is actually use cases where we want multiple values per dataset? @huaruiwu can you please make a fiddle that reproduces your issue? Thought, isn't the same as #5231? If so, there is already a PR that tries to fix that case: #5332. However it's a different approach because it "limits" the number of values instead of picking only one. If we agree on a bug, I think I prefer this PR (#5578), I would simply make sure to pick the closest one. |
I would call this a bug Agree on picking the closest point |
Agree this sounds like a bug. I can't think of reasons to have multiple values from the same dataset in the tooltip so returning the nearest works for me. For completeness, the |
Is it always true in case of |
Just got rid of the option and made it so that it always returns only the closest point per dataset. Should I add the same thing for when mode is set to "y"? |
added test |
@benmccann Thanks for the review! I think I fixed the two issues you found. |
@benmccann missed that one. just removed the |
Thanks! |
When is it possible to get this merged? |
@huaruiwu we're just waiting for @simonbrunel 's review before merging |
@benmccann done |
any chance of getting this merged soon? |
There are two issues remaining in this PR.
Note: For implementation, I would modify getNearestItems to optionally consider hitRadius:
And use it:
Would need to modify all calls to getNearestItems (to supply axis instead of distanceMetric, Thoughts, @benmccann @simonbrunel @etimberg (others welcome too)? |
@kurkle 's suggestion generally sounds good to me. @huaruiwu I know this PR has been open for a long time. Are you still interested in moving forward and do you think you'd be able to implement the suggested changes? |
Hi @huaruiwu we haven't heard anything about this PR for awhile, so I'm just checking to see if you're still interested in pursuing. If we don't hear anything after awhile we may end up closing this PR, but you can always pursue it again in the future. Thanks! |
hi @benmccann, it's been a while since I've used ChartJS. I do want to take a look at this but not sure when I'll get to it. Feel free to close this if you're cleaning things up. I can always open another PR when I decide to come back to it |
Ok, I'll close it for now just to make it easier for us to keep track of which PRs need review. Please feel free to reopen at any time though |
I have a problem with the tooltips.
Sometimes when using mode x tooltip option, you want there to be only one item per dataset. Currently you can set pointHitRadius low. While this would work most of the time, sometimes it will not return anything because of the different distances between data points. With an option like the one in this PR, you can have a larger pointHitRadius but always get only one tooltip item returned per dataset.