Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

AutomaticDateTimeScaleOptions Class

Contains settings for a date-time axis data when its scale mode is automatic.

Namespace: DevExpress.Xpf.Charts

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

NuGet Package: DevExpress.Wpf.Charts

#Declaration

public class AutomaticDateTimeScaleOptions :
    DateTimeAggregationScaleOptionsBase

#Remarks

An object of the AutomaticDateTimeScaleOptions type is returned by the AxisX2D.DateTimeScaleOptions, AxisX3D.DateTimeScaleOptions, and RadarAxisX2D.DateTimeScaleOptions properties.

In the Automatic scale mode, the Chart control automatically defines the most optimal unit of measure for an axis based on the input data, the current chart control size and the zoom level.

Data for each interval on the X-axis is aggregated using the function specified by the AutomaticDateTimeScaleOptions.AggregateFunction property. Although by default, aggregate function is set to Average, it can be changed to Minimum, Maximum, Sum, etc.

To learn more, see Data Aggregation.

#Example

This code snippet shows how to access the automatic date time scale options for the X-axis scale and specify the aggregate function. The automatic options allow the chart control to automatically define the optimal unit of measure for an axis based on the input data, and the zoom level.

<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="350" Width="525">
    <Grid>
        <dxc:ChartControl>
            <dxc:XYDiagram2D>
                <dxc:XYDiagram2D.AxisX>
                    <dxc:AxisX2D>
                        <dxc:AxisX2D.DateTimeScaleOptions>
                            <dxc:AutomaticDateTimeScaleOptions  AggregateFunction="Sum"/>
                        </dxc:AxisX2D.DateTimeScaleOptions>
                    </dxc:AxisX2D>
                </dxc:XYDiagram2D.AxisX>
            </dxc:XYDiagram2D>
        </dxc:ChartControl>
    </Grid>
</Window>
See Also