menu

MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class CategoryAxis - MAUI API Reference | Syncfusion

    Show / Hide Table of Contents

    Class CategoryAxis

    The CategoryAxis is an indexed based axis that plots values based on the index of the data point collection. It displays string values in axis labels.

    Inheritance
    System.Object
    ChartAxis
    CategoryAxis
    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.CalculateVisibleInterval(DoubleRange, Size)
    ChartAxis.CalculateVisibleRange(DoubleRange, Size)
    ChartAxis.ComputeDesiredSize(Size)
    ChartAxis.CrossAxisName
    ChartAxis.CrossAxisNameProperty
    ChartAxis.CrossesAt
    ChartAxis.CrossesAtProperty
    ChartAxis.DrawAxis(ICanvas, Rect)
    ChartAxis.DrawAxisLine(ICanvas, Single, Single, Single, Single)
    ChartAxis.DrawGridLine(ICanvas, Double, Single, Single, Single, Single)
    ChartAxis.DrawMajorTick(ICanvas, Double, PointF, PointF)
    ChartAxis.DrawMinorTick(ICanvas, Double, PointF, PointF)
    ChartAxis.EdgeLabelsDrawingMode
    ChartAxis.EdgeLabelsDrawingModeProperty
    ChartAxis.EnableAutoIntervalOnZooming
    ChartAxis.EnableAutoIntervalOnZoomingProperty
    ChartAxis.GetActualDesiredIntervalsCount(Size)
    ChartAxis.IsInversed
    ChartAxis.IsInversedProperty
    ChartAxis.IsVisible
    ChartAxis.IsVisibleProperty
    ChartAxis.LabelCreated
    ChartAxis.LabelExtent
    ChartAxis.LabelExtentProperty
    ChartAxis.LabelRotation
    ChartAxis.LabelRotationProperty
    ChartAxis.LabelsIntersectAction
    ChartAxis.LabelsIntersectActionProperty
    ChartAxis.LabelsPosition
    ChartAxis.LabelsPositionProperty
    ChartAxis.LabelStyle
    ChartAxis.LabelStyleProperty
    ChartAxis.MajorGridLineStyle
    ChartAxis.MajorGridLineStyleProperty
    ChartAxis.MajorTickStyle
    ChartAxis.MajorTickStyleProperty
    ChartAxis.Name
    ChartAxis.NameProperty
    ChartAxis.OnBindingContextChanged()
    ChartAxis.OnCreateLabels()
    ChartAxis.OnLabelCreated(ChartAxisLabel)
    ChartAxis.OnParentSet()
    ChartAxis.PlotOffsetEnd
    ChartAxis.PlotOffsetEndProperty
    ChartAxis.PlotOffsetStart
    ChartAxis.PlotOffsetStartProperty
    ChartAxis.PointToValue(Double, Double)
    ChartAxis.RenderNextToCrossingValue
    ChartAxis.RenderNextToCrossingValueProperty
    ChartAxis.ShowMajorGridLines
    ChartAxis.ShowMajorGridLinesProperty
    ChartAxis.ShowTrackballLabel
    ChartAxis.ShowTrackballLabelProperty
    ChartAxis.TickPosition
    ChartAxis.TickPositionProperty
    ChartAxis.Title
    ChartAxis.TitleProperty
    ChartAxis.TrackballLabelStyle
    ChartAxis.TrackballLabelStyleProperty
    ChartAxis.TrackballLabelTemplate
    ChartAxis.TrackballLabelTemplateProperty
    ChartAxis.ValueToPoint(Double)
    ChartAxis.VisibleLabels
    ChartAxis.VisibleMaximum
    ChartAxis.VisibleMinimum
    ChartAxis.ZoomFactor
    ChartAxis.ZoomFactorProperty
    ChartAxis.ZoomPosition
    ChartAxis.ZoomPositionProperty
    Namespace: Syncfusion.Maui.Charts
    Assembly: Syncfusion.Maui.Charts.dll
    Syntax
    public class CategoryAxis : ChartAxis, IThemeElement
    Remarks

    Category axis supports only for the X(horizontal) axis.

    To render an axis, add the category axis instance to the chart’s XAxes collection as shown in the following code sample.

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

    Title - To render the title, refer to this Title property.

    Grid Lines - To show and customize the grid lines, refer these 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.

    Axis Crossing - For axis crossing, refer these CrossesAt, CrossAxisName, and RenderNextToCrossingValue properties.

    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

    ArrangeByIndexProperty

    Identifies the ArrangeByIndex bindable property.

    Declaration
    public static readonly BindableProperty ArrangeByIndexProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty

    IntervalProperty

    Identifies the Interval bindable property.

    Declaration
    public static readonly BindableProperty IntervalProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty

    LabelPlacementProperty

    Identifies the LabelPlacement bindable property.

    Declaration
    public static readonly BindableProperty LabelPlacementProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty

    PlotBandsProperty

    Identifies the PlotBands bindable property.

    Declaration
    public static readonly BindableProperty PlotBandsProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty

    Properties

    ArrangeByIndex

    Gets or sets a value that determines whether to arrange the axis labels by index or by value.

    Declaration
    public bool ArrangeByIndex { get; set; }
    Property Value
    Type Description
    System.Boolean

    Its default is True.

    Remarks

    True - Used to arrange the axis labels by index.

    False - Used to arrange the axis labels by value.

    Examples
    • MainPage.xaml
    • MainPage.xaml.cs
    <chart:SfCartesianChart>
    
            <chart:SfCartesianChart.XAxes>
                <chart:CategoryAxis ArrangeByIndex="False" />
            </chart:SfCartesianChart.XAxes>
    
    </chart:SfCartesianChart>
    SfCartesianChart chart = new SfCartesianChart();
    
    CategoryAxis xaxis = new CategoryAxis(){ ArrangeByIndex = false, };
    chart.XAxes.Add(xaxis);

    Interval

    Gets or sets a value that can be used to customize the interval between the axis labels.

    Declaration
    public double Interval { get; set; }
    Property Value
    Type Description
    System.Double

    It accepts double values and 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.

    Note: This is only applicable for SfCartesianChart.

    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);

    PlotBands

    Gets or sets the collection of plot bands to be added to the chart axis.

    Declaration
    public NumericalPlotBandCollection PlotBands { get; set; }
    Property Value
    Type
    NumericalPlotBandCollection

    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
    Microsoft.Maui.Graphics.Size availableSize
    Returns
    Type
    System.Double
    Overrides
    ChartAxis.CalculateActualInterval(DoubleRange, Size)
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved