Skip to main content

DateTimeLabelFormat Class

Stores the date-time axis label format for the specified measurement unit.

Namespace: DevExpress.Maui.Charts

Assembly: DevExpress.Maui.Charts.dll

NuGet Package: DevExpress.Maui.Charts

Declaration

public class DateTimeLabelFormat :
    BindableObject

Remarks

The ChartView can detect if adjacent date-time argument values belong to different time intervals (for example, days of different months) and automatically display a transition label on a date-time axis (for example, the first-day label of the next month) with a different format.

To enable this functionality:

  1. Set the DateTimeAxisX.LabelFormatAutoReplaceOptions property to an AxisLabelFormatAutoReplaceOptions object.
  2. Add DateTimeLabelFormat objects that specify label formats (Format) for arguments of different measurement units (MeasureUnit) to the AxisLabelFormatAutoReplaceOptions.LabelFormats collection.

    Note

    LabelFormats is a content property. You can skip property tags in the markup.

    If you do not populate the LabelFormats collection explicitly, the following default formats are used depending on the axis’s MeasureUnit and GridAlignment settings:

    Measurement Unit*

    Label Format

    Millisecond

    Millisecond - “SSS”
    Second - “HH:mm:ss SSS”
    Day - “dd MMMM HH:mm:ss SSS”
    Year - “dd/MM/yyyy HH:mm:ss SSS”

    Second
    Minute
    Hour

    Second - “HH:mm:ss”
    Day - “dd MMMM HH:mm:ss”
    Year - “dd/MM/yyyy HH:mm:ss”

    Day
    Week

    Day - “dd MMMM”
    Year - “dd MMMM yyyy”

    Month
    Quarter

    Month - “MMMM”
    Year - “MMMM yyyy”

    Year

    Year - “yyyy”

    Measurement Unit* - the larger measurement unit assigned to the MeasureUnit and GridAlignment properties.

Example

The following example configures a date-time axis so that it automatically shows when the next month starts:

Axis Label Format Auto Replace

<dxc:DateTimeAxisX x:Name="xAxis" GridAlignment="Day" GridSpacing="5">
    <dxc:DateTimeAxisX.LabelFormatAutoReplaceOptions>
        <dxc:AxisLabelFormatAutoReplaceOptions>
            <dxc:DateTimeLabelFormat MeasureUnit="Day" Format="d"/>
            <dxc:DateTimeLabelFormat MeasureUnit="Month" Format="MMM, d"/>
        </dxc:AxisLabelFormatAutoReplaceOptions>
    </dxc:DateTimeAxisX.LabelFormatAutoReplaceOptions>
</dxc:DateTimeAxisX>

Inheritance

System.Object
BindableObject
DateTimeLabelFormat
See Also