Skip to main content
A newer version of this page is available. .

ChartControl.AxisScaleChanged Event

Occurs when the scale mode, measure unit, grid alignment or grid spacing of the axis scale has been changed.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v21.2.UI.dll

NuGet Packages: DevExpress.Win.Charts, DevExpress.Win.Design

Declaration

public event EventHandler<AxisScaleChangedEventArgs> AxisScaleChanged

Event Data

The AxisScaleChanged event's data class is AxisScaleChangedEventArgs. The following properties provide information specific to this event:

Property Description
Axis Returns the axis whose scale mode, measure unit, grid alignment or grid spacing has been changed.
GridSpacingChange Returns information about grid spacing changes.
ScaleModeChange Returns information about scale mode changes.

Remarks

Note that the event args type depends on the current axis scale type. The following table shows dependencies between scale types and argument types.

Scale type Args type
Qualitative QualitativeScaleChangedEventArgs
Numeric NumericScaleChangedEventArgs
Date-Time DateTimeScaleChangedEventArgs
Time-Span TimeSpanScaleChangedEventArgs

For Web Charts, handle the WebChartControl.AxisScaleChanged event.

Example

Handle the ChartControl.AxisScaleChanged event to obtain the axis‘ automatically calculated grid alignment and measurement unit values when the scale mode is automatic. The event arguments also contain the axis itself. This event occurs when the scale mode, measure unit, grid alignment, or grid spacing of the axis scale has been changed.

View Example

private void Form1_Load(object sender, EventArgs e) {
    this.ordersTableAdapter.Fill(this.nwindDataSet.Orders);
    this.chartControl.AxisScaleChanged += OnAxisScaleChanged;
}

private void OnAxisScaleChanged(object sender, AxisScaleChangedEventArgs e) {
    AxisX axis = e.Axis as AxisX;
    DateTimeScaleChangedEventArgs args = e as DateTimeScaleChangedEventArgs;
    if ((args == null) || (args == null)) return;
    axis.Title.Text = String.Format(
        "The Axis Grid Alignment Unit is {0}\r\nThe Axis Measure Unit is {1}", 
        args.GridAlignmentChange.NewValue,
        args.MeasureUnitChange.NewValue);
}
See Also