ChartControl.Zoom Event
Occurs when an end-user zooms in or out of the ChartControl.
Namespace: DevExpress.XtraCharts
Assembly: DevExpress.XtraCharts.v24.2.UI.dll
NuGet Package: DevExpress.Win.Charts
#Declaration
public event ChartZoomEventHandler Zoom
#Event Data
The Zoom event's data class is ChartZoomEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Axis |
Gets the X-axis of the diagram point. |
Axis |
Gets the Y-axis of the diagram point. |
New |
Obsolete. Gets the new value of the Axis property for the X-axis.
|
New |
Obsolete. Gets the new value of the Axis property for the Y-axis.
|
New |
Gets the new value of the Axis |
New |
Gets the new value of the Axis |
Old |
Obsolete. Gets the old value of the Axis property for the X-axis.
|
Old |
Obsolete. Gets the old value of the Axis property for the Y-axis.
|
Old |
Gets the old value of the Axis |
Old |
Gets the old value of the Axis |
Type | Gets the zoom type. |
#Remarks
Note that this event is raised for 2D Charts only. In 3D Charts, the similar ChartControl.Zoom3D event is raised.
Note
In the Zoom event handler, you cannot change the layout of a chart. For example, modifying the Chart
#Example
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));
}
}
}