Bober02 Posted July 23, 2010 Report Share Posted July 23, 2010 Hey there, I am trying to read mouse position relative to plot area (so X represents the value on the XAxis over which mouse is currently hovering over). I managed to get it right using histTest for MouseDown event like this: HitTestResults hitTest = chart1.HitTest(e.GetPosition(chart1));if (!hitTest.IsInsidePlotArea) return null; Axis xAxis = chart1.AxisX;Axis yAxis = chart1.AxisY; double X = xAxis.PixelToValue(hitTest.PositionRelativeToPlotArea.X);double Y = yAxis.PixelToValue(hitTest.PositionRelativeToPlotArea.Y); return new NumberDataPoint(X, Y);But the above does not work for Mouse up event (values of X Y are just stupid). Any idea how I can get those values? Quote Link to comment Share on other sites More sharing options...
JuanC Posted July 27, 2010 Report Share Posted July 27, 2010 Have you compared the point you are passing to the HitTest methods as well as the PositionRelativeToPlotArea value between the mouse down and mouse up position (assuming you are not dragging the mouse)? If the chart has not changed I am not sure how subsequent calls with the same value would not return the same PositionRelativeToPlotArea and in turn the same X/Y values. Have you tried also calling this (for testing purposes) on your MouseMove event? JuanC Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.