AxisLabelFormatAutoReplaceOptions.LabelFormats Property
Gets the collection of date-time axis label formats for arguments of different measurement units.
Namespace: DevExpress.XamarinForms.Charts
Assembly: DevExpress.XamarinForms.Charts.dll
NuGet Package: DevExpress.XamarinForms.Charts
Declaration
public DateTimeLabelFormatCollection LabelFormats { get; }
Property Value
Type | Description |
---|---|
DateTimeLabelFormatCollection | A DateTimeLabelFormatCollection object that stores formats of the axis labels. |
Property Paths
You can access this nested property as listed below:
Object Type | Path to LabelFormats |
---|---|
DateTimeAxisX |
|
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, set the DateTimeAxisX.LabelFormatAutoReplaceOptions property to an AxisLabelFormatAutoReplaceOptions object and use its LabelFormats property to access and manage the collection of label formats for date-time arguments of different measurement units. An individual item of this collection is a DateTimeLabelFormat object.
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 | Second - “HH:mm:ss” |
Day | Day - “dd MMMM” |
Month | Month - “MMMM” |
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:
<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>