Skip to main content

DateTimeScaleOptions.MeasureUnit Property

Gets or sets the detail level for date-time values.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v24.1.dll

NuGet Package: DevExpress.Charts

Declaration

[XtraSerializableProperty]
public DateTimeMeasureUnit MeasureUnit { get; set; }

Property Value

Type Description
DateTimeMeasureUnit

A DateTimeMeasureUnit enumeration value which represents the axis’ detail level.

Available values:

Name Description
Millisecond

Specifies a millisecond as the measurement unit for date-time values.

Second

Specifies a second as the measurement unit for date-time values.

Minute

Specifies a minute as the measurement unit for date-time values.

Hour

Specifies an hour as the measurement unit for date-time values.

Day

Specifies a day as the measurement unit for date-time values.

Week

Specifies a week as the measurement unit for date-time values.

Month

Specifies a month as the measurement unit for date-time values.

Quarter

Specifies a quarter of a year as the measurement unit for date-time values.

Year

Specifies a year as the measurement unit for date-time values.

Property Paths

You can access this nested property as listed below:

Object Type Path to MeasureUnit
AxisBase
.DateTimeScaleOptions .MeasureUnit

Remarks

This property is available when the SeriesBase.ArgumentScaleType or SeriesBase.ValueScaleType property is set to DateTime, and the ScaleOptionsBase.ScaleMode property is set to Manual.

DateTimeScaleOptions.MeasureUnit = Quarter DateTimeScaleOptions.MeasureUnit = Year
MeasureUnit_Day MeasureUnit_Month

Note

To access DateTimeScaleOptions, use the AxisBase.DateTimeScaleOptions property.

To define a date-time measurement unit to which the beginning of a diagram’s gridlines and labels should be aligned, use the DateTimeScaleOptions.GridAlignment property.

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 MeasureUnit 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