The requested page is not available for the requested platform. You are viewing the content for Default platform.

DateTimeMeasureUnit Enum

Lists the values that specify the unit of measurement for date-time values within a chart control.

Namespace: DevExpress.UI.Xaml.Charts

Assembly: DevExpress.UI.Xaml.Charts.v19.1.dll

Declaration

public enum DateTimeMeasureUnit
Public Enum DateTimeMeasureUnit

Members

Name Description
Day

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

Hour

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

Millisecond

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

Minute

Specifies a minute 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.

Second

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

Week

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

Year

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

Remarks

The values listed by this enumeration are used to set the AxisBase.DateTimeMeasureUnit and AxisBase.DateTimeGridAlignment properties.

Examples

The following example demonstrates how to bind a chart to data provided by a ViewModel.

To do this, it is necessary to assign the DataSourceAdapter object to the Series.Data property and specify the datasource for the adapter via its DataSourceAdapter.DataSource property.

Note

A complete sample project is available at: https://github.com/DevExpress-Examples/how-to-bind-a-chart-to-data-e4362

<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Charts="using:DevExpress.UI.Xaml.Charts"
    xmlns:local="using:BindChart"
    x:Class="BindChart.MainPage"
    mc:Ignorable="d">

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">

        <Charts:CartesianChart>
            <Charts:Series>
                <Charts:Series.View>
                    <Charts:LineSeriesView/>
                </Charts:Series.View>
                <Charts:Series.Data>
                    <Charts:DataSourceAdapter DataSource="{Binding ItemsSource}">
                        <Charts:DataMember DataMemberType="Argument" ColumnName="PointArgument" 
                                           ScaleType="DateTime"/>
                        <Charts:DataMember DataMemberType="Value" ColumnName="PointValue" 
                                           ScaleType="Auto"/>
                    </Charts:DataSourceAdapter>
                </Charts:Series.Data>
            </Charts:Series>
            <Charts:CartesianChart.AxisX>
                <Charts:AxisX DateTimeGridAlignment="Year" DateTimeMeasureUnit="Hour">
                    <Charts:AxisX.LabelOptions>
                        <Charts:AxisLabelOptions Pattern="{}{V:yyyy}"/>
                    </Charts:AxisX.LabelOptions>
                </Charts:AxisX>
            </Charts:CartesianChart.AxisX>
        </Charts:CartesianChart>
    </Grid>
</Page>
See Also