Class ChartAxisLabelStyle
Represents the chart axis's label style class.
Inherited Members
Namespace: Syncfusion.Maui.Toolkit.Charts
Assembly: Syncfusion.Maui.Toolkit.dll
Syntax
public class ChartAxisLabelStyle : ChartLabelStyle, ITextElement, IThemeElement
Remarks
To customize the axis labels appearance, create an instance of the ChartAxisLabelStyle class and set to the LabelStyle property.
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis>
<chart:CategoryAxis.LabelStyle>
<chart:ChartAxisLabelStyle TextColor = "Red" FontSize="14"/>
</chart:CategoryAxis.LabelStyle>
</chart:CategoryAxis>
</chart:SfCartesianChart.XAxes>
</chart:SfCartesianChart>
It provides more options to customize the chart axis label.
LabelAlignment - To position the axis label, refer to this LabelAlignment property.
LabelFormat - To customize the numeric or date-time format of the axis label, refer to this LabelFormat property.
TextColor - To customize the text color, refer to this TextColor property.
Background - To customize the background color, refer to this Background property.
Stroke - To customize the stroke color, refer to this Stroke property.
StrokeWidth - To modify the stroke width, refer to this StrokeWidth property.
Constructors
ChartAxisLabelStyle()
Initializes a new instance of the ChartAxisLabelStyle.
Declaration
public ChartAxisLabelStyle()
Fields
LabelAlignmentProperty
Identifies the LabelAlignment bindable property.
Declaration
public static readonly BindableProperty LabelAlignmentProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the LabelAlignment bindable property indicates the position of the axis label.
MaxWidthProperty
Identifies the MaxWidth bindable property.
Declaration
public static readonly BindableProperty MaxWidthProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the MaxWidth bindable property represents the maximum width value for wrapped axis labels.
WrappedLabelAlignmentProperty
Identifies the WrappedLabelAlignment bindable property.
Declaration
public static readonly BindableProperty WrappedLabelAlignmentProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the WrappedLabelAlignment bindable property is used to align wrapped axis labels based on the label's rectangle.
Properties
LabelAlignment
Gets or sets a value that indicates the position of the axis label.
Declaration
public ChartAxisLabelAlignment LabelAlignment { get; set; }
Property Value
Type | Description |
---|---|
ChartAxisLabelAlignment | It accepts ChartAxisLabelAlignment values and the default value is Center. |
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis>
<chart:CategoryAxis.LabelStyle>
<chart:ChartAxisLabelStyle LabelAlignment="Center"/>
</chart:CategoryAxis.LabelStyle>
</chart:CategoryAxis>
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis>
<chart:NumericalAxis.LabelStyle>
<chart:ChartAxisLabelStyleLabelAlignment="Center"/>
</chart:NumericalAxi.LabelStyle>
</chart:NumericalAxis>
</chart:SfCartesianChart.YAxes>
</chart:SfCartesianChart>
MaxWidth
Gets or sets the maximum width value for wrapped axis labels.
Declaration
public double MaxWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double | It accepts |
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis LabelsIntersectAction="Wrap">
<chart:CategoryAxis.LabelStyle>
<chart:ChartAxisLabelStyle MaxWidth="30"/>
</chart:CategoryAxis.LabelStyle>
</chart:CategoryAxis>
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis LabelsIntersectAction="Wrap">
<chart:NumericalAxis.LabelStyle>
<chart:ChartAxisLabelStyle MaxWidth="30"/>
</chart:NumericalAxi.LabelStyle>
</chart:NumericalAxis>
</chart:SfCartesianChart.YAxes>
</chart:SfCartesianChart>
WrappedLabelAlignment
Gets or sets the value to align wrapped axis labels based upon the labels rect.
Declaration
public ChartAxisLabelAlignment WrappedLabelAlignment { get; set; }
Property Value
Type | Description |
---|---|
ChartAxisLabelAlignment | It accepts ChartAxisLabelAlignment values and the default value is Start. |
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis LabelsIntersectAction="Wrap">
<chart:CategoryAxis.LabelStyle>
<chart:ChartAxisLabelStyle WrappedLabelAlignment="Center" MaxWidth="30"/>
</chart:CategoryAxis.LabelStyle>
</chart:CategoryAxis>
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis LabelsIntersectAction="Wrap">
<chart:NumericalAxis.LabelStyle>
<chart:ChartAxisLabelStyle WrappedLabelAlignment="Center" MaxWidth="30"/>
</chart:NumericalAxi.LabelStyle>
</chart:NumericalAxis>
</chart:SfCartesianChart.YAxes>
</chart:SfCartesianChart>