We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to display fixed number of data points in SfChart

Platform: Xamarin.Forms |
Control: SfChart |
Published Date: May 16, 2017 |
Last Revised Date: March 1, 2018

Auto scrolling delta feature in SfChart is used to ensure that the specified range of data is always visible in the chart. You can view the remaining data points by scrolling. It always shows the recently added data points at the end, and scrolling will be reset to the end of the range whenever a new point is added. The following code examples illustrate how to specify the auto scrolling delta value for different axis types.

Category axis

The AutoScrollingDelta property of ChartAxis is used to customize the number of visible points to be displayed in chart when using the category axis.

XAML:

 

C#:

 

Screenshot:

C:\Users\divya.venkatesan\AppData\Local\Microsoft\Windows\INetCache\Content.Word\Category.png

 

Numerical axis

The AutoScrollingDelta property of ChartAxis is used to customize the visible range to be displayed in chart when using the numerical axis.

XAML:

 

C#:

 

Screenshot:

C:\Users\divya.venkatesan\AppData\Local\Microsoft\Windows\INetCache\Content.Word\Numerical.png

 

Date-Time axis

The AutoScrollingDelta property of ChartAxis is used to customize the visible range to be loaded in chart when using the date-time axis, and the AutoScrollingDeltaType property of DateTimeAxis is used to specify the date-time component for AutoScrollingDelta value.

XAML:

 

C#:

 

Screenshot:

C:\Users\divya.venkatesan\AppData\Local\Microsoft\Windows\INetCache\Content.Word\DateTime.png

 

2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment
Comments
Naveen C Ramachandrappa
Jun 14, 2017
This always displays the last set of bars based on the number specified but I would want to show the first few bars and enable user to scroll further to see the rest. Is it possible? Reply
Saravana Pandian Murugan [Syncfusion]
Jul 20, 2017

You can achieve this requirement by using ZoomFactor/ZoomPosition of ChartAxis. Please find the code snippet below. 

  

Code Example: 

  

  

chart.PrimaryAxis = new CategoryAxis() 

            { 

  

                ZoomFactor = 0.5, 

  

                ZoomPosition = 0       

      

            }; 

  

  

ZoomFactor: 

  

ZoomFactor defines the percentage of visible range from the total range of axis. For instance, when the Range is from 0 to 100 and ZoomFactor is 0.5, the visible range will be 0 to 50 or 50 to 100 (the start of the range will be determined by ZoomPosition).  

 

ZoomPosition: 

  

ZoomPosition defines the start of the range of values that need to be displayed as a result of ZoomFactor. For the above scenario, when the ZoomPosition is 0.25 then the visible range will be from 25 to 75. 

  

Note: The sum of ZoomFactor and ZoomPosition must also fall within the value of 0 to 1.  

 

ankush
Jul 14, 2017

+1 Naveen

Reply

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon