mariusmuntean / ChartJs.Blazor

Brings Chart.js charts to Blazor
https://www.iheartblazor.com/
MIT License
691 stars 152 forks source link

How to find nearest point to where the user clicked on a line chart #126

Closed smasonuk closed 4 years ago

smasonuk commented 4 years ago

Describe your question

I have a line chart like below. When the click even it fired I get a lot of potential points in the event that fires since the points are quite close. What is the best way to figure out which point the user was most closest to? I'm this specific example I don't actually need the point, just the x value, so either will work.

image

Which Blazor project type is your question related to?

client side

Which charts is this question related to?

line

smasonuk commented 4 years ago

I've figured out how to change this using the interaction mode of nearest.