-
Notifications
You must be signed in to change notification settings - Fork 981
Labels
Help WantedScott won't do this soon, but PRs from the community are welcome!Scott won't do this soon, but PRs from the community are welcome!
Description
I successfully implemented suggestion for handling the MouseMove event in charts with only one dataset with ScottPlot 5 in VB .NET. However, I’m facing another situation with multiple curves being drawn, but MyCrosshair is only triggered for the last dataset. I suspect this problem is related to the following method that uses ‘PltPerfElev.Plot.LastRender’:
Dim nearest As DataPoint = splt.Data.GetNearest(mouseLocation, PltPerfElev.Plot.LastRender)
Is it possible to review the following code to present CrossHair for the entire dataset?
Here is my VB. NET implementation.

Private Sub MouseMoveHandler(
s As Object, e As MouseEventArgs)
Dim mousePixel As New Pixel(
e.Location.X, e.Location.Y)
Dim mouseLocation As Coordinates =
PltPerfElev.Plot.GetCoordinates(mousePixel)
Dim nearest As DataPoint = splt.Data.
GetNearest(mouseLocation, PltPerfElev.Plot.LastRender)
If nearest.IsReal Then
MyCrosshair.IsVisible = True
MyCrosshair.Position = nearest.Coordinates
PltPerfElev.Refresh()
lbPerfElev.Text = $" X = {nearest.X:#,##0.0} m " &
$" - Y = {nearest.Y:#,##0.0} cm"
ElseIf MyCrosshair.IsVisible Then
MyCrosshair.IsVisible = False
PltPerfElev.Refresh()
lbPerfElev.Text = $""
End If
End Sub
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Help WantedScott won't do this soon, but PRs from the community are welcome!Scott won't do this soon, but PRs from the community are welcome!