Axis Padding in .NET MAUI Cartesian Chart

10 Jul 20262 minutes to read

PlotOffsetStart

The PlotOffsetStart property, of type double and measured in pixels (px), is used to provide padding to the axis at the start position. The default value is 0. The following code sample demonstrates the padding applied to the start position for both the X and Y axes.

NOTE

Prerequisite: Ensure that the required NuGet package is installed, the necessary namespaces are imported, and the SfCartesianChart control is properly configured in your application. For detailed setup and configuration instructions, refer to the Getting Started guide.

<chart:SfCartesianChart>
    <chart:SfCartesianChart.XAxes>
        <chart:CategoryAxis PlotOffsetStart="30"/>
    </chart:SfCartesianChart.XAxes>

    <chart:SfCartesianChart.YAxes>
        <chart:NumericalAxis PlotOffsetStart="30"/>
    </chart:SfCartesianChart.YAxes>
    <!-- code omitted for brevity -->
</chart:SfCartesianChart>
SfCartesianChart chart = new SfCartesianChart();

CategoryAxis primaryAxis = new CategoryAxis()
{
    PlotOffsetStart = 30
};
chart.XAxes.Add(primaryAxis);

NumericalAxis secondaryAxis = new NumericalAxis()
{
    PlotOffsetStart = 30
};
chart.YAxes.Add(secondaryAxis);
// code omitted for brevity
this.Content = chart;

PlotOffsetStart support in .NET MAUI Cartesian Chart.

PlotOffsetEnd

The PlotOffsetEnd property, of type double and measured in pixels (px), is used to provide padding to the axis at the end position. The default value is 0. The following code sample demonstrates the padding applied to the end position for both the X and Y axes.

NOTE: PlotOffsetStart and PlotOffsetEnd set padding at the edges of the plot area; for rounding/spacing of the visible axis range, use the RangePadding property instead.

<chart:SfCartesianChart>
    <chart:SfCartesianChart.XAxes>
        <chart:CategoryAxis PlotOffsetEnd="30"/>
    </chart:SfCartesianChart.XAxes>

    <chart:SfCartesianChart.YAxes>
        <chart:NumericalAxis PlotOffsetEnd="30"/>
    </chart:SfCartesianChart.YAxes>
    <!-- code omitted for brevity -->
</chart:SfCartesianChart>
SfCartesianChart chart = new SfCartesianChart();

CategoryAxis primaryAxis = new CategoryAxis()
{
    PlotOffsetEnd = 30
};
chart.XAxes.Add(primaryAxis);

NumericalAxis secondaryAxis = new NumericalAxis()
{
    PlotOffsetEnd = 30
};
chart.YAxes.Add(secondaryAxis);
// code omitted for brevity
this.Content = chart;

PlotOffsetEnd support in .NET MAUI Cartesian Chart.