menu

WinUI

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class CategoryAxis - WinUI API Reference | Syncfusion

    Show / Hide Table of Contents

    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.

    Inheritance
    System.Object
    ChartAxis
    CategoryAxis
    Implements
    System.ComponentModel.INotifyPropertyChanged
    Inherited Members
    ChartAxis.ActualRangeChanged
    ChartAxis.AutoScrollingDelta
    ChartAxis.AutoScrollingDeltaProperty
    ChartAxis.AutoScrollingMode
    ChartAxis.AutoScrollingModeProperty
    ChartAxis.AxisLineOffset
    ChartAxis.AxisLineOffsetProperty
    ChartAxis.AxisLineStyle
    ChartAxis.AxisLineStyleProperty
    ChartAxis.CalculateActualRange()
    ChartAxis.CalculateNiceInterval(DoubleRange, Size)
    ChartAxis.CalculateVisibleRange(DoubleRange, Size)
    ChartAxis.CrosshairLabelTemplate
    ChartAxis.CrosshairLabelTemplateProperty
    ChartAxis.EdgeLabelsDrawingMode
    ChartAxis.EdgeLabelsDrawingModeProperty
    ChartAxis.EnableAutoIntervalOnZooming
    ChartAxis.EnableAutoIntervalOnZoomingProperty
    ChartAxis.GetActualDesiredIntervalsCount(Size)
    ChartAxis.GetRenderedRect()
    ChartAxis.Header
    ChartAxis.HeaderProperty
    ChartAxis.HeaderStyle
    ChartAxis.HeaderStyleProperty
    ChartAxis.HeaderTemplate
    ChartAxis.HeaderTemplateProperty
    ChartAxis.IsInversed
    ChartAxis.IsInversedProperty
    ChartAxis.LabelCreated
    ChartAxis.LabelExtent
    ChartAxis.LabelExtentProperty
    ChartAxis.LabelRotation
    ChartAxis.LabelRotationProperty
    ChartAxis.LabelsIntersectAction
    ChartAxis.LabelsIntersectActionProperty
    ChartAxis.LabelStyle
    ChartAxis.LabelStyleProperty
    ChartAxis.LabelTemplate
    ChartAxis.LabelTemplateProperty
    ChartAxis.MajorGridLineStyle
    ChartAxis.MajorGridLineStyleProperty
    ChartAxis.MajorTickStyle
    ChartAxis.MajorTickStyleProperty
    ChartAxis.MeasureOverride(Size)
    ChartAxis.OnApplyTemplate()
    ChartAxis.OnCreateLabels()
    ChartAxis.OnLabelCreated(ChartAxisLabel)
    ChartAxis.OpposedPosition
    ChartAxis.OpposedPositionProperty
    ChartAxis.PlotOffsetEnd
    ChartAxis.PlotOffsetEndProperty
    ChartAxis.PlotOffsetStart
    ChartAxis.PlotOffsetStartProperty
    ChartAxis.PointToValue(Double, Double)
    ChartAxis.PropertyChanged
    ChartAxis.ShowMajorGridLines
    ChartAxis.ShowMajorGridLinesProperty
    ChartAxis.ShowTrackballLabel
    ChartAxis.ShowTrackballLabelProperty
    ChartAxis.TickLineSize
    ChartAxis.TickLineSizeProperty
    ChartAxis.TrackballLabelTemplate
    ChartAxis.TrackballLabelTemplateProperty
    ChartAxis.ValueToPoint(Double)
    ChartAxis.VisibleMaximum
    ChartAxis.VisibleMinimum
    ChartAxis.ZoomFactor
    ChartAxis.ZoomFactorProperty
    ChartAxis.ZoomPosition
    ChartAxis.ZoomPositionProperty
    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.

    • MainPage.xaml
    • MainPage.xaml.cs
    <chart:SfCartesianChart>
    
            <chart:SfCartesianChart.XAxes>
                <chart:CategoryAxis/>
            </chart:SfCartesianChart.XAxes>
    
    </chart:SfCartesianChart>
    SfCartesianChart chart = new SfCartesianChart();
    
    CategoryAxis xaxis = new CategoryAxis();
    chart.XAxes.Add(xaxis);	

    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
    • MainPage.xaml
    • MainPage.xaml.cs
    <chart:SfCartesianChart>
    
            <chart:SfCartesianChart.XAxes>
                <chart:CategoryAxis Interval="2" />
            </chart:SfCartesianChart.XAxes>
    
    </chart:SfCartesianChart>
    SfCartesianChart chart = new SfCartesianChart();
    
    CategoryAxis xaxis = new CategoryAxis(){ Interval = 2, };
    chart.XAxes.Add(xaxis);	

    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 OnTicks.

    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
    • MainPage.xaml
    • MainPage.xaml.cs
    <chart:SfCartesianChart>
    
        <chart:SfCartesianChart.XAxes>
            <chart:CategoryAxis LabelPlacement="BetweenTicks" />
        </chart:SfCartesianChart.XAxes>
    
    </chart:SfCartesianChart>
    SfCartesianChart chart = new SfCartesianChart();
    
    CategoryAxis xaxis = new CategoryAxis();
    xaxis.LabelPlacement = LabelPlacement.BetweenTicks;
    chart.XAxes.Add(xaxis);

    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
    ChartAxis.ApplyRangePadding(DoubleRange, Double)

    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
    ChartAxis.CalculateActualInterval(DoubleRange, Size)

    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
    Overrides
    ChartAxis.CalculateVisibleInterval(DoubleRange, Size)

    Implements

    System.ComponentModel.INotifyPropertyChanged
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved