Skip to main content

ManualDateTimeScaleOptions.MeasureUnit Property

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

Namespace: DevExpress.Xpf.Charts

Assembly: DevExpress.Xpf.Charts.v24.2.dll

NuGet Package: DevExpress.Wpf.Charts

Declaration

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 millisecond as the measurement unit for date-time values.

Second

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

Minute

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

Hour

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

Day

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

Week

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

Month

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

Quarter

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

Year

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

Remarks

This property is available when one of the AxisX2D.DateTimeScaleOptions, AxisX3D.DateTimeScaleOptions or RadarAxisX2D.DateTimeScaleOptions properties is set to ManualDateTimeScaleOptions.

ManualDateTimeScaleOptions.MeasureUnit = Day ManualDateTimeScaleOptions.MeasureUnit = Month
ManualDateTimeScale_MeasureUnit_Day ManualDateTimeScale_MeasureUnit_Month

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

To learn more, see Data Aggregation.

Example

This example demonstrates how to use the manual date-time scale options of the X-axis.

Data aggregation is enabled automatically for the date-time scale on the X-axis in both automatic and manual scale options.

When the AxisX2D.DateTimeScaleOptions property is set to ManualDateTimeScaleOptions, you can define the ManualDateTimeScaleOptions.GridAlignment, ManualDateTimeScaleOptions.MeasureUnit and ManualDateTimeScaleOptions.AggregateFunction properties manually.

To use the automatic date-time scale options, set the AxisX2D.DateTimeScaleOptions property to AutomaticDateTimeScaleOptions, and select the appropriate AutomaticDateTimeScaleOptions.AggregateFunction.

To prevent the axis scale from being divided into intervals (and thus prevent chart data from being aggregated), set the ManualDateTimeScaleOptions.AggregateFunction property to None.

<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts" 
        x:Class="WpfApplication19.MainWindow"
        Title="MainWindow" Height="400" Width="525">
    <Grid>
        <dxc:ChartControl>
            <dxc:XYDiagram2D >
                <dxc:XYDiagram2D.AxisX>
                    <dxc:AxisX2D GridLinesMinorVisible="True" GridLinesVisible="True">
                        <dxc:AxisX2D.DateTimeScaleOptions>
                            <dxc:ManualDateTimeScaleOptions AggregateFunction="Maximum" AutoGrid="False"
                                                            GridAlignment="Year" MeasureUnit="Month" 
                                                            GridSpacing="3" GridOffset="1"/>
                        </dxc:AxisX2D.DateTimeScaleOptions>
                    </dxc:AxisX2D>
                </dxc:XYDiagram2D.AxisX>
                <dxc:LineSeries2D DataSource="{Binding Path=Rate}" 
                                  ArgumentDataMember="Argument" ValueDataMember="Value"  />
            </dxc:XYDiagram2D>          
        </dxc:ChartControl>
    </Grid>
</Window>

The following code snippet (auto-collected from DevExpress Examples) contains a reference 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