getPointsAtEvent for Line charts doesn't give correct points
getPointsAtEvent for line charts always returns all the points at a label when the mouse enters pointHitDetectionRadius for any of the points at that label.
Shouldn't it just return the closest point based on the pointHitDetectionRadius?
If not, then how do I get which point the user clicked on?
Ty.
I was a bit frustrated by this too. After some not-close-to-exhaustive-testing, I noticed that the array returned by that function appears to order the points from the left end of the pointHitDetectionRadius to the right. What I ended up doing for now is just grabbing the middle value in the array like so: var theFrames = theChart.getPointsAtEvent(evt); var theFrame = theFrames[Math.floor(theFrames.length / 2)];
Hello, today I am closing all issues that are only affecting version 1 of Chart.js as WONTFIX.
If this issue does affect version 2 as well, I apologize for the error. Please create a test case against Chart.js 2 using on of the below websites and we will be happy to reopen the issue and update its classification:
- http://jsbin.com/
- http://jsfiddle.net/
- http://codepen.io/pen/
- Premade template: http://codepen.io/pen?template=JXVYzq