I'm plotting X-Y data using ScatterLine series in a XamChart.
I'm using the XamChart.MouseMove to display the X-Y values in a couple text boxes as the user mouses over the chart. Something like this:
void OnChartMouseMove(object sender, MouseEventArgs e){ var args = chart.HitTest(e); var x = args.XValue; var y = args.YValue;
XValueTextBlock.Text = String.Format("X: {0:G5}", x); YValueTextBlock.Text = String.Format("Y: {0:G5}", y);}
Everything works well until the user changes the application window size, resulting in a resized XamChart. After that, the values of HitTestArgs.XValue and HitTestArgs.YValue are incorrect.
Has anyone else seen this problem? Anyone know how to work around?
Hello,
You can try to use the GetPosition method which works fine to me:
private void xamChart1_MouseMove(object sender, MouseEventArgs e){ Point p = e.GetPosition(xamChart1); XValueTextBlock.Text = String.Format("X: {0:G5}", p.X); YValueTextBlock.Text = String.Format("Y: {0:G5}", p.Y);}
I hope this helps
Vlad
> You can try to use the GetPosition method
Thank you, Vlad, for your response. However,
I'm needing the chart values.