Skip to main content

ScaleOptionsBase.ScaleMode Property

Gets or sets the scale mode for an axis.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v24.1.dll

NuGet Package: DevExpress.Charts

Declaration

[XtraSerializableProperty]
public ScaleMode ScaleMode { get; set; }

Property Value

Type Description
ScaleMode

A scale mode.

Available values:

Name Description
Automatic

Identifies the automatic scale mode, meaning that data is automatically aggregated according to the chosen ScaleGridOptionsBase.AggregateFunction.

Manual

Identifies the manual scale mode, meaning that the GridAlignment (DateTimeScaleOptions.GridAlignment, NumericScaleOptions.GridAlignment or TimeSpanScaleOptions.GridAlignment) and MeasureUnit (DateTimeScaleOptions.MeasureUnit, NumericScaleOptions.MeasureUnit or TimeSpanScaleOptions.MeasureUnit) properties are in effect, and they should be manually defined. Also, you can use the ScaleGridOptionsBase.AggregateFunction property to choose the aggregate function.

Continuous

Identifies the continuous scale mode, meaning data aggregation is disabled and you can only change the grid alignment using the GridAlignment (DateTimeScaleOptions.GridAlignment, NumericScaleOptions.GridAlignment or TimeSpanScaleOptions.GridAlignment) property.

Interval

Identifies the interval scale mode, which means that the axis scale is divided into intervals. Note that the Chart Control does not apply the resampling mechanism to points in this scale mode.

Remarks

Use the ScaleMode property to define which scale mode should be used for an axis: manual, automatic, interval or continuous.

Note that when automatic mode is defined, the DateTimeScaleOptions.GridAlignment and DateTimeScaleOptions.MeasureUnit properties aren’t available. You can change these properties in this mode using the ChartControl.AxisScaleChanged(WebChartControl.AxisScaleChanged or ChartControlSettings.AxisScaleChanged) event handler.

The following images demonstrate this property in action for the date-time data.

The property value

The resulting image

ScaleMode = Manual;

MeasureUnit = Quarter;

ManualScaleMode

ScaleMode = Automatic

AutomaticScaleMode

ScaleMode = Continuous

ContinuousScaleMode

ScaleMode = Interval

IntervalScaleMode

Example

This example shows how to use DateTimeScaleOptions to reduce the number of visible series points.

Result

The following code configures the axis scale settings to resemble to the chart appearance above:

DateTimeScaleOptions dateTimeScaleOptions = ((XYDiagram)chartControl.Diagram).AxisX.DateTimeScaleOptions;

dateTimeScaleOptions.WorkdaysOnly = true;
dateTimeScaleOptions.ScaleMode = ScaleMode.Manual;
dateTimeScaleOptions.AggregateFunction = AggregateFunction.Average;
dateTimeScaleOptions.MeasureUnit = DateTimeMeasureUnit.Month;
dateTimeScaleOptions.GridAlignment = DateTimeGridAlignment.Quarter;
dateTimeScaleOptions.GridSpacing = 1;

The following table lists the API members the code above uses:

Member Description
AxisBase.DateTimeScaleOptions Stores the options that define the behavior of a scale when its type is date-time.
ScaleOptionsBase.ScaleMode Gets or sets the scale mode for an axis.
ScaleMode Lists the values that specify the scale mode for an axis.
DateTimeScaleOptions.MeasureUnit Gets or sets the detail level for date-time values.
DateTimeMeasureUnit Lists the values that specify the detail level for date-time values.
ScaleGridOptionsBase.GridOffset Gets or sets the offset of grid lines and major tickmarks.
ScaleGridOptionsBase.AggregateFunction Gets or sets the value indicating the aggregate function that should be used to relieve data.
AggregateFunction Lists the values that specify the aggregate function used for an axis.
DateTimeScaleOptions.GridAlignment Gets or sets the date-time measure unit to which the beginning of an axis’ gridlines and labels should be aligned.
DateTimeGridAlignment Lists the values that specify the date-time measurement unit, to which the beginning of a diagram’s gridlines and labels should be aligned.
ScaleGridOptionsBase.GridSpacing Gets or sets the interval between grid lines and major tickmarks.

The following code snippets (auto-collected from DevExpress Examples) contain references to the ScaleMode property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also