Chart.js get the nearest point when clicked on canvas
问题 is there a way to get the nearest point when clicked anywhere on canvas? Maybe somehow harvest the core 'nearest' method? Thanks 回答1: I think you will find getElementsAtXAxis very helpful. Basically, getElementsAtXAxis has a very similar behaviour to getElementsAtEvent although when the click event doesn't intersect a point of the chart, it will return the nearest ChartElement. The only downside is that it will return all the ChartElement on the nearest x-axis index. So, if you use multiple