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

Disable autoscrolling when panning to old values

Thread ID:

Created:

Updated:

Platform:

Replies:

140693 Nov 1,2018 04:38 PM UTC Nov 2,2018 07:19 AM UTC Xamarin.Forms 1
loading
Tags: SfChart
Alessandro
Asked On November 1, 2018 04:39 PM UTC

Hello,
I have a SfChart that shows a series of XY values horizontally.
The data is not fixed but it "increases" every second along the Y axis (see it as a real time plot of values along time). Using AutoScrollingDelta="20000" and AutoScrollingMode="End", I ensure that the most recent data is always visible (the most recent value is always plotted on the right edge).
Now I decided to activate the Panning functionality, so that the user can scroll to left and check the older values while new data continues to be added. The problem is that the user pans, but immediately the view returns back to the most recent values, I assume due to the AutoScroll.
I can detect when the panning starts (with Scroll event) so can I stop the AutoScroll function in that moment? Then I clould show a "reset" button to reactivate it.
Thanks for your support

Michael Prabhu M [Syncfusion]
Replied On November 2, 2018 07:19 AM UTC

Hi Alessandro, 

Greetings from Syncfusion, we have achieved your requirement by setting AutoScrollingDelta as double.NaN during panning. We have reset the AutoScrollingDelta value in Scroll event and enable AutoScrollingDelta in button click.  Please refer below code snippet. 

Code snippet [XAML]:   
<StackLayout> 
        <Button Text="Enable AutoScrolling" Clicked="EnableAutoScrolling_Clicked"/> 
 
        <chart:SfChart x:Name="Chart" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Scroll="Chart_Scroll" > 
        ………….. 
        </chart:SfChart> 
 
</StackLayout>         
 
  
Code snippet [C#]:    
private void Chart_Scroll(object sender, Syncfusion.SfChart.XForms.ChartScrollEventArgs e) 
{ 
            e.Axis.AutoScrollingDelta = double.NaN; 
} 
void EnableAutoScrolling_Clicked(object sender, System.EventArgs e) 
{ 
            Chart.PrimaryAxis.AutoScrollingDelta = 30; 
} 
 

We have prepared a sample based on your requirement, you can download the sample from below link; 


Regards, 
Michael 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

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

;