How to find the nearest point when using a cursor?
Posted: Thu Jul 19, 2018 1:54 am
Hi:
I already added a MouseMove event handler to the cursor that can dynamically move the cursor when the mouse move. I see the documentation that when using a cursor, you can set "cursor.SnapToPoints = true" to mark all the lines' data points that closest to the cursor. However, my requirement is to only mark one line's data point which has the closest distance to the mouse position, not all the lines. Is there any way to make that happen?
What's more, is there anyway to control the visiblity of the cursor marker correctly? I currently set cursor.TrackPoint.Color1 = Colors.Transparent, cursor.TrackPoint.Color2 = Colors.Transparent, cursor.TrackPoint.Color3 = Colors.Transparent, and cursor.TrackPoint.BorderColor = Colors.Transparent initially, and add MouseEnter event (cursor.TrackPoint.BorderColor = Colors.White) and MouseLeave event(cursor.TrackPoint.BorderColor = Colors.Transparent).
The application could toggle the visiblity of the line. When I move the mouse out and disable line's visibility, and then move mouse back to the chart, the cursor markers are still there. You can see the picture that when I make blue line's PointlineSeries.LineVisible = false, the cusror circle markers of that line are still there.
Thanks.
I already added a MouseMove event handler to the cursor that can dynamically move the cursor when the mouse move. I see the documentation that when using a cursor, you can set "cursor.SnapToPoints = true" to mark all the lines' data points that closest to the cursor. However, my requirement is to only mark one line's data point which has the closest distance to the mouse position, not all the lines. Is there any way to make that happen?
What's more, is there anyway to control the visiblity of the cursor marker correctly? I currently set cursor.TrackPoint.Color1 = Colors.Transparent, cursor.TrackPoint.Color2 = Colors.Transparent, cursor.TrackPoint.Color3 = Colors.Transparent, and cursor.TrackPoint.BorderColor = Colors.Transparent initially, and add MouseEnter event (cursor.TrackPoint.BorderColor = Colors.White) and MouseLeave event(cursor.TrackPoint.BorderColor = Colors.Transparent).
The application could toggle the visiblity of the line. When I move the mouse out and disable line's visibility, and then move mouse back to the chart, the cursor markers are still there. You can see the picture that when I make blue line's PointlineSeries.LineVisible = false, the cusror circle markers of that line are still there.
Thanks.