Currently I am using two XamDataCharts, one for a macro view and another for a detailed view. Hence I would like the ability to subscribe to a zoom event on the Chart when I do a zoom to selection (I am setting DefaultInteraction="Drag Zoom"), through which the event can capture x,y coordinates on the zoom-box. the catch is that I want to capture the points from the chart and not from the screen. Let's say I'm plotting on both axis between 0 and 10 and then I zoom on a selection from points X = 1 to X = 5 and Y = 2 to Y = 3, how can I get does values out of the chart? Using these values I will be able to redraw on the detailed view chart the small section I selected with the accurate scale.
you can get this information by invoking the Axes' GetUnscaledValue method in a WindowRectChanged event handler. here's a code snippet to demonstrate:
private void XamDataChart_WindowRectChanged(object sender, Infragistics.RectChangedEventArgs e) { XamDataChart theChart = sender as XamDataChart; Axis xAxis = theChart.Axes.OfType<CategoryXAxis>().FirstOrDefault(); Axis yAxis = theChart.Axes.OfType<NumericYAxis>().FirstOrDefault();
ScalerParams scalerParams = new ScalerParams(theChart.WindowRect, theChart.ViewportRect, false);
double windowMinimumY = yAxis.GetUnscaledValue(theChart.ViewportRect.Bottom, scalerParams); double windowMaximumY = yAxis.GetUnscaledValue(theChart.ViewportRect.Top, scalerParams);
double windowMinimumX = xAxis.GetUnscaledValue(theChart.ViewportRect.Left, scalerParams); double windowMaximumX = xAxis.GetUnscaledValue(theChart.ViewportRect.Right, scalerParams);
string info = string.Format("X Axis Range: {0} to {1}, Y Axis Range: {2} to {3}", windowMinimumX, windowMaximumX, windowMinimumY, windowMaximumY);
System.Diagnostics.Debug.WriteLine(info); }