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.v20.1.UI.dll

Declaration

public event EventHandler<AxisScaleChangedEventArgs> AxisScaleChanged
Public Event AxisScaleChanged As EventHandler(Of AxisScaleChangedEventArgs)

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

Examples

Use the ChartControl.AxisScaleChanged (WebChartControl.AxisScaleChanged) event to obtain the axis' automatically calculated grid alignment and measurement unit values, when the scale mode is automatic. Moreover the event arguments contains the axis itself. This event is raised when the scale mode, measure unit, grid alignment or grid spacing of the axis scale has been changed.

private void Form1_Load(object sender, EventArgs e) {
    chartControl1.AxisScaleChanged += OnChartAxisScaleChanged;
}

private void OnChartAxisScaleChanged(object sender, AxisScaleChangedEventArgs e) {
    AxisX axisX = e.Axis as AxisX;
    if (axisX == null) return;
    // In this event, you can access the properties of the corresponding axis, and
    // obtain the automatically calculated value for the axis date-time grid alignment and measure unit.
    axisX.Title.Visibility = DefaultBoolean.True;
    axisX.Title.Text = String.Format(
        "The Axis Grid Alignment Unit is {0} \r\nThe Axis Measure Unit is {1}", 
        e.Axis.DateTimeScaleOptions.GridAlignment.ToString(),
        e.Axis.DateTimeScaleOptions.MeasureUnit.ToString()
    );
}
See Also