private static void UpdateChartHorizontalPanOffsetAndZoom(RadChartBase chart) { if (ChartViewUtilities.GetIsHorizontalRangeEnabled(chart) && !suspendedCharts.Contains(chart)) { suspendedCharts.Add(chart); if (chart.PlotAreaClip.Width > 0) { double horizontalStart = ChartViewUtilities.GetHorizontalStart(chart); double horizontalEnd = ChartViewUtilities.GetHorizontalEnd(chart); double horizontalRange = horizontalEnd - horizontalStart; if (horizontalRange > 0 && horizontalRange <= 1) { double newZoomX = 1 / horizontalRange; double virtualWidth = newZoomX * chart.PlotAreaClip.Width; double panOffsetX = -horizontalStart * virtualWidth; chart.Zoom = new Size(newZoomX, chart.Zoom.Height); chart.PanOffset = new Point(panOffsetX, chart.PanOffset.Y); } } suspendedCharts.Remove(chart); } }
private static void UpdateHorizontalRangeValues(RadChartBase chart) { if (ChartViewUtilities.GetIsHorizontalRangeEnabled(chart) && !suspendedCharts.Contains(chart)) { suspendedCharts.Add(chart); var virtualWidth = chart.PlotAreaClip.Width * chart.Zoom.Width; if (virtualWidth > 0) { double oldHorizontalStart = ChartViewUtilities.GetHorizontalStart(chart); double oldHorizontalEnd = ChartViewUtilities.GetHorizontalEnd(chart); double newHorizontalStart = (-chart.PanOffset.X) / virtualWidth; double newHorizontalEnd = ((-chart.PanOffset.X) + chart.PlotAreaClip.Width) / virtualWidth; ChartViewUtilities.SetHorizontalStart(chart, newHorizontalStart); ChartViewUtilities.SetHorizontalEnd(chart, newHorizontalEnd); } suspendedCharts.Remove(chart); } }