ChartZoomEventArgs.NewYRange Property

Gets the new value of the AxisBase.VisualRange property for the Y-axis.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v20.2.dll

Declaration

public RangeInfo NewYRange { get; }
Public ReadOnly Property NewYRange As RangeInfo

Property Value

Type Description
RangeInfo

A RangeInfo object which represents the new value of the axis range.

Remarks

Use the ChartZoomEventArgs.OldYRange and NewYRange properties to obtain the Y-axis's AxisBase.VisualRange property values before and after a chart is zoomed in the ChartControl.Zoom event handler. For more information on zooming a chart diagram, please refer to the Zooming and Scrolling (2D XY-Charts) topic.

Examples

This example shows how to adjust the secondary Y- axis range along which the chart is zoomed.

To accomplish this task, obtain the secondary Y-axis in the ChartControl.Zoom event handler and specify a custom secondary Y-axis range by calling the Range.SetMinMaxValues method.

using System;
using System.Windows.Forms;
using DevExpress.XtraCharts;

namespace UsingZoomEvent {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
        }

        private void chartControl1_Zoom(object sender, ChartZoomEventArgs e) {
            ChartControl chart = (ChartControl)sender;
            XYDiagram diagram = (XYDiagram)chart.Diagram;
            diagram.SecondaryAxesY[0].VisualRange.SetMinMaxValues(Convert.ToDouble(e.NewYRange.MinValue) / 2,
                                                                  Convert.ToDouble(e.NewYRange.MaxValue));
        }
    }
}
See Also