Articles in this section
Category / Section

How to display a fixed number of data points in .NET MAUI Chart (SfCartesianChart)?

2 mins read

The auto scrolling delta feature in .NET MAUI Cartesian Chart ensures that a specified range of data is always visible in the chart, allowing you to view remaining data points by scrolling. This feature keeps the most recently added data points at the end of the chart, resetting the scrolling to the end of the range whenever a new point is added. To implement this feature for different types of axes, you can use the code examples provided below:

Category axis
To use the category axis, the AutoScrollingDelta property of ChartAxis can be used to customize the number of visible points displayed on the chart.

[XAML]

<chart:SfCartesianChart.XAxes>
  <chart:CategoryAxis AutoScrollingDelta="3"/>
</chart:SfCartesianChart.XAxes>

[C#]

CategoryAxis primaryAxis = new CategoryAxis();
primaryAxis.AutoScrollingDelta = 3;

CategoryAxis.png

Numerical axis
To use the numerical axis, the AutoScrollingDelta property of ChartAxis can be used to customize the visible range displayed on the chart.

[XAML]

<chart:SfCartesianChart.XAxes>
     <chart:NumericalAxis AutoScrollingDelta="50"/>
</chart:SfCartesianChart.XAxes>

[C#]

NumericalAxis primaryAxis = new NumericalAxis();
primaryAxis.AutoScrollingDelta = 50;

NumericalAxis.png

Date-Time axis
To use date-time axes, the AutoScrollingDelta property of ChartAxis can be used to specify the visible range to be loaded, while the AutoScrollingDeltaType property of DateTimeAxis can be used to specify the date-time component for the AutoScrollingDelta value. These properties can be customized to meet your specific charting needs.

[XAML]

<chart:SfCartesianChart.XAxes>
    <chart:DateTimeAxis AutoScrollingDelta="3" 
                        AutoScrollingDeltaType="Months"/>
</chart:SfCartesianChart.XAxes>

[C#]

DateTimeAxis primaryAxis = new DateTimeAxis();
primaryAxis.AutoScrollingDelta = 3;
primaryAxis.AutoScrollingDeltaType = DateTimeIntervalType.Months;

DateTimeAxis.png

Note:

AutoScrollingDeltaMode property can be used to determine whether the axis should be scrolled from start position or end position. The default value of AutoScrollingMode is End.

Conclusion
I hope you enjoyed learning about displaying a Fixed Number of Data Points in .NET MAUI Charts.

You can refer to our .NET MAUI Charts feature tour page to know about its other groundbreaking feature representations. You can also explore our .NET MAUI Charts documentation to understand how to present and manipulate data.

For current customers, you can check out our .NET MAUI components from the Licence and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our .NET MAUI Charts and other .NET MAUI components.

If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac , or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied