Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

wpf location

Solved!
Go to solution

Hello,

 

I've been using the measurement graph object in Form and now I need to reuse some functions in WPF. Some of them was dealing with hit test because they need to know the current coordinate clicked by the user, not the screen coordinate, but the position in the plan related to the current x and y scaling.

 

The best approach I could find was to compute a x & y ratio using GetPlotAreaPosition(e) and GetPlotAreaSize() but this works only when the plot is not Zoomed nor panned. I was unable to find the properties related to zoom and pan to correct my ratio calculation.

 

Any help would be appreciated, Best regards,

0 Kudos
Message 1 of 3
(5,059 Views)
Solution
Accepted by topic author thumble

You can get the relative (ratio) value for the screen point returned by GetPlotAreaPosition using the ScreenToRelative method, but this is independent of the scale configuration.


To get the interpolated data point under the mouse, you can use the RelativeToData method instead. Or if you want to get the closest plot data value, you can use the FindNearestValue method.

~ Paul H
Message 2 of 3
(5,053 Views)

Thank you so much, that's exactly what I was looking for.

 

0 Kudos
Message 3 of 3
(5,030 Views)