Axis line in .NET MAUI Chart
1 Jan 20252 minutes to read
Customization
The polar chart axis provides support for customizing the style of the axis line by defining the AxisLineStyle property, as shown in the code sample below.
NOTE
The customization of axis lines using the AxisLineStyle property can only be applied to the secondary axis.
<chart:SfPolarChart>
. . .
<chart:SfPolarChart.SecondaryAxis>
<chart:NumericalAxis>
<chart:NumericalAxis.AxisLineStyle>
<chart:ChartLineStyle StrokeWidth ="2" Stroke="Red"/>
</chart:NumericalAxis.AxisLineStyle>
</chart:NumericalAxis>
</chart:SfPolarChart.SecondaryAxis>
</chart:SfPolarChart>SfPolarChart chart = new SfPolarChart();
. . .
NumericalAxis secondaryAxis = new NumericalAxis();
ChartLineStyle axisLineStyle = new ChartLineStyle()
{
Stroke = Colors.Red,
StrokeWidth = 2,
};
secondaryAxis.AxisLineStyle = axisLineStyle;
chart.SecondaryAxis = secondaryAxis;
this.Content = chart;Offset
The padding to the axis line is defined by using the AxisLineOffset property.
<chart:SfPolarChart>
. . .
<chart:SfPolarChart.SecondaryAxis>
<chart:NumericalAxis AxisLineOffset="25">
<chart:NumericalAxis.AxisLineStyle>
<chart:ChartLineStyle StrokeWidth ="2" Stroke="Red"/>
</chart:NumericalAxis.AxisLineStyle>
</chart:NumericalAxis>
</chart:SfPolarChart.SecondaryAxis>
</chart:SfPolarChart>SfPolarChart chart = new SfPolarChart();
. . .
NumericalAxis secondaryAxis = new NumericalAxis();
secondaryAxis.AxisLineOffset = 25;
ChartLineStyle axisLineStyle = new ChartLineStyle()
{
Stroke = Colors.Red,
StrokeWidth = 2,
};
secondaryAxis.AxisLineStyle = axisLineStyle;
chart.SecondaryAxis = secondaryAxis;
this.Content = chart;