Get mouse down data position?

Dec 24, 2009 at 5:51 PM

I am plotting some data that starts on the x axis at around 20000 and ends around40000.  I need to be able to on MouseDown get the X and Y -data- positions, not just the mouse position on the ChartPlotter. I noticed in an example that the CursorCoordinateGraph generates the mouse current position for the x and y.  The X coordinate is exactly what I need, because it shows the mouse current position on the x axis, but the y is not- because I need to get the data's y position at a given x, not the y position of the mouse.

How can I get the x and y data points representing my actual data at a given mouse x on mouse down or mouse over?

Thanks and happy holidays!

Dec 26, 2009 at 3:51 PM


To get the position of mouse in you data, you should use something like this:

var transform = plotter.Transform;

var mouseScreenPosition = Mouse.GetPosition(plotter.CentralGrid);

var mousePositionInData = mouseScreenPosition.ScreenToViewport(transform);

and then you should somehow implement searching of proper y value by x value found by method I've described in your data.


Also you might be interested in AxisControlSamples in DevSamples.

Best regards,


Dec 28, 2009 at 3:05 AM

That sounds perfect, thanks Mikhail!

Dec 29, 2009 at 3:12 PM

Thank you. This is very useful for me as well.