Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
75
HitText's XValue and YValue incorrect after chart resizes?
posted

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?