Class DateTimeAxis
DateTimeAxis is used to plot DateTime values in chart axis.
Implements
Inherited Members
Namespace: Syncfusion.UI.Xaml.Charts
Assembly: Syncfusion.Chart.WinUI.dll
Syntax
public class DateTimeAxis : RangeAxisBase, INotifyPropertyChanged
Remarks
The date-time axis uses date time scale and displays date-time values as axis labels in the specified format.
To render an axis, create an instance of DateTimeAxis and add it to the XAxes or YAxes collection.
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:DateTimeAxis/>
</chart:SfCartesianChart.XAxes>
</chart:SfCartesianChart>
Header - To render the header, refer to this Header property.
Grid Lines - To show and customize the grid lines, refer to these ShowMajorGridLines, MajorGridLineStyle, MinorTicksPerInterval, and MinorGridLineStyle properties.
Tick Lines - To show and customize the tick lines, refer to these MajorTickStyle, MinorTickStyle, and MinorTicksPerInterval properties.
Axis Line - To customize the axis line using the AxisLineStyle property.
Range Customization - To customize the axis range with help of the Minimum, and Maximum properties.
Labels Customization - To customize the axis labels, refer to this LabelStyle property.
Inversed Axis - Inverse the axis using the IsInversed property.
Interval - To define the axis labels interval using the Interval, and IntervalType properties.
Constructors
DateTimeAxis()
Initializes a new instance of the DateTimeAxis class.
Declaration
public DateTimeAxis()
Fields
AutoScrollingDeltaTypeProperty
The DependencyProperty for AutoScrollingDeltaType property.
Declaration
public static readonly DependencyProperty AutoScrollingDeltaTypeProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
IntervalProperty
The DependencyProperty for Interval property.
Declaration
public static readonly DependencyProperty IntervalProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
IntervalTypeProperty
The DependencyProperty for IntervalType property.
Declaration
public static readonly DependencyProperty IntervalTypeProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
MaximumProperty
The DependencyProperty for Maximum property.
Declaration
public static readonly DependencyProperty MaximumProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
MinimumProperty
The DependencyProperty for Minimum property.
Declaration
public static readonly DependencyProperty MinimumProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
RangePaddingProperty
The DependencyProperty for RangePadding property.
Declaration
public static readonly DependencyProperty RangePaddingProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Properties
ActualMaximum
Gets the actual maximum value of the DateTimeAxis.
Declaration
public DateTime ActualMaximum { get; }
Property Value
Type |
---|
System.DateTime |
Examples
<StackPanel>
<TextBlock Text="{Binding ElementName=xAxis, Path=ActualMaximum, Mode=TwoWay}" />
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:DateTimeAxis x:Name="xAxis"/>
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis x:Name="yAxis"/>
</chart:SfCartesianChart.YAxes>
<chart:SfCartesianChart.Series>
<chart:ColumnSeries ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue" />
</chart:SfCartesianChart.Series>
</chart:SfCartesianChart>
</StackPanel>
ActualMinimum
Gets the actual minimum value of the DateTimeAxis.
Declaration
public DateTime ActualMinimum { get; }
Property Value
Type |
---|
System.DateTime |
Examples
<StackPanel>
<TextBlock Text="{Binding ElementName=xAxis, Path=ActualMinimum, Mode=TwoWay}" />
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:DateTimeAxis x:Name="xAxis"/>
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis x:Name="yAxis"/>
</chart:SfCartesianChart.YAxes>
<chart:SfCartesianChart.Series>
<chart:ColumnSeries ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue" />
</chart:SfCartesianChart.Series>
</chart:SfCartesianChart>
</StackPanel>
AutoScrollingDeltaType
Gets or sets the enum DateTimeIntervalType to determine the unit of time used for the delta value for auto-scrolling on a DateTime axis.
Declaration
public DateTimeIntervalType AutoScrollingDeltaType { get; set; }
Property Value
Type | Description |
---|---|
DateTimeIntervalType | This property takes the DateTimeIntervalType as its value. |
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:DateTimeAxis AutoScrollingDelta = "3" AutoScrollingDeltaType="Years"/>
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis/>
</chart:SfCartesianChart.YAxes>
</chart:SfCartesianChart>
Interval
Gets or sets a value that can be used to change the interval between labels.
Declaration
public double Interval { get; set; }
Property Value
Type | Description |
---|---|
System.Double | It accepts |
Remarks
If this property is not set, the interval will be calculated automatically.
By default, the interval will be calculated based on the minimum and maximum values of the provided data.
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:DateTimeAxis Interval="6" IntervalType="Months" />
</chart:SfCartesianChart.XAxes>
</chart:SfCartesianChart>
IntervalType
Gets or sets the date time unit of the value specified in the Interval property.
Declaration
public DateTimeIntervalType IntervalType { get; set; }
Property Value
Type | Description |
---|---|
DateTimeIntervalType | It accepts the DateTimeIntervalType value and its default value is Auto. |
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:DateTimeAxis IntervalType="Months"/>
</chart:SfCartesianChart.XAxes>
</chart:SfCartesianChart>
Maximum
Gets or sets the maximum value of the time period to be displayed on the chart axis.
Declaration
public DateTime Maximum { get; set; }
Property Value
Type | Description |
---|---|
System.DateTime | The default value is |
Remarks
If we didn't set the maximum value, it will be calculated from the underlying collection.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:DateTimeAxis Minimum="2021/05/10" Maximum="2021/11/01"/>
</chart:SfCartesianChart.XAxes>
</chart:SfCartesianChart>
Minimum
Gets or sets the minimum value of the time period to be displayed on the chart axis.
Declaration
public DateTime Minimum { get; set; }
Property Value
Type | Description |
---|---|
System.DateTime | The default value is |
Remarks
If we didn't set the minimum value, it will be calculated from the underlying collection.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:DateTimeAxis Minimum="2021/05/10" Maximum="2021/11/01"/>
</chart:SfCartesianChart.XAxes>
</chart:SfCartesianChart>
RangePadding
Gets or sets a padding type for the date time axis range.
Declaration
public DateTimeRangePadding RangePadding { get; set; }
Property Value
Type | Description |
---|---|
DateTimeRangePadding | It acceps the DateTimeRangePadding value and its default value is Auto |
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:DateTimeAxis RangePadding ="Round" />
</chart:SfCartesianChart.XAxes>
</chart:SfCartesianChart>
Methods
ApplyRangePadding(DoubleRange, Double)
Declaration
protected override DoubleRange ApplyRangePadding(DoubleRange range, double interval)
Parameters
Type | Name | Description |
---|---|---|
DoubleRange | range | |
System.Double | interval |
Returns
Type |
---|
DoubleRange |
Overrides
CalculateActualInterval(DoubleRange, Size)
Declaration
protected override double CalculateActualInterval(DoubleRange range, Size availableSize)
Parameters
Type | Name | Description |
---|---|---|
DoubleRange | range | |
Windows.Foundation.Size | availableSize |
Returns
Type |
---|
System.Double |
Overrides
CalculateActualRange()
Declaration
protected override DoubleRange CalculateActualRange()
Returns
Type |
---|
DoubleRange |
Overrides
CalculateNiceInterval(DoubleRange, Size)
Declaration
protected override double CalculateNiceInterval(DoubleRange actualRange, Size availableSize)
Parameters
Type | Name | Description |
---|---|---|
DoubleRange | actualRange | |
Windows.Foundation.Size | availableSize |
Returns
Type |
---|
System.Double |
Overrides
CalculateVisibleRange(DoubleRange, Size)
Declaration
protected override DoubleRange CalculateVisibleRange(DoubleRange range, Size availableSize)
Parameters
Type | Name | Description |
---|---|---|
DoubleRange | range | |
Windows.Foundation.Size | availableSize |
Returns
Type |
---|
DoubleRange |