Class CategoryAxis
The category axis is an index-based axis that plots values based on the index of the data point collection. It displays string values in the axis labels.
Implements
Inherited Members
Namespace: Syncfusion.UI.Xaml.Charts
Assembly: Syncfusion.Chart.WinUI.dll
Syntax
public class CategoryAxis : ChartAxis, INotifyPropertyChanged
Remarks
Category axis supports only for the X(horizontal) axis.
To render an axis, create an instance of CategoryAxis and add it to the XAxes collection.
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis/>
</chart:SfCartesianChart.XAxes>
</chart:SfCartesianChart>
The CategoryAxis supports the following features. Refer to the corresponding APIs, for more details and example codes.
Header - To render the header, refer to this Header property.
Grid Lines - To show and customize the grid lines, refer the ShowMajorGridLines, and MajorGridLineStyle properties.
Axis Line - To customize the axis line using the AxisLineStyle property.
Labels Customization - To customize the axis labels, refer to this LabelStyle property.
Inversed Axis - Inverse the axis using the IsInversed property.
Label Placement - To place the axis labels in between or on the tick lines, refer to this LabelPlacement property.
Interval - To define the interval between the axis labels, refer to this Interval property.
Constructors
CategoryAxis()
Declaration
public CategoryAxis()
Fields
IntervalProperty
The DependencyProperty for Interval property.
Declaration
public static readonly DependencyProperty IntervalProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
LabelPlacementProperty
The DependencyProperty for LabelPlacement property.
Declaration
public static readonly DependencyProperty LabelPlacementProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Properties
Interval
Gets or sets a value that can be used to customize the interval between the axis range.
Declaration
public double Interval { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The default value is double.NaN. |
Remarks
If this property is not set, the interval will be calculated automatically.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis Interval="2" />
</chart:SfCartesianChart.XAxes>
</chart:SfCartesianChart>
LabelPlacement
Gets or sets a value that determines whether to place the axis label in between or on the tick lines.
Declaration
public LabelPlacement LabelPlacement { get; set; }
Property Value
Type | Description |
---|---|
LabelPlacement | It accepts the LabelPlacement values and the default value is |
Remarks
BetweenTicks - Used to place the axis label between the ticks.
OnTicks - Used to place the axis label with the tick as the center.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis LabelPlacement="BetweenTicks" />
</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
CalculateVisibleInterval(DoubleRange, Size)
Declaration
protected override double CalculateVisibleInterval(DoubleRange visibleRange, Size availableSize)
Parameters
Type | Name | Description |
---|---|---|
DoubleRange | visibleRange | |
Windows.Foundation.Size | availableSize |
Returns
Type |
---|
System.Double |