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. Image for the cookie policy date

Dynamic insertion of points in the graph with zooming

I use sfChart in Xamarin.Forms for Android, I have graphics with large number of points.For fast loading, i  display only a part of the points, and then at Zoom I add other points to see the graph in details, but when adding points sfChart redraws the whole Graph and shows it with ZoomFactor = 1,  How can this be changed? I also tried to use the different Axes of CategoryAxis and NumbericAxis and i had the same situation with it. I'm using FastLine Series
Best regards
Alexandr

2 Replies

NA Novel Alex August 14, 2017 08:32 AM UTC

I had the wrong Binding in Series  In IsVisible. He gave an incorrect result. And turned off the zoom



ME Manivannan Elangovan Syncfusion Team August 14, 2017 06:02 PM UTC

Hi Novel Alex,
 
Thanks for using Syncfusion products.
 
We are able to achieve your requirement by using ZoomFactorZoomPosition properties and platform specific codes.  Please refer the following code snippet to stay zoomed position, after added the new data points in chart. 
 
Code snippet:
 
private void GetVisibleRangeValues() 
{ 
    List<double>visibleValues = DependencyService.Get<IAxisDependencyService>().GetVisibleRange(xAxis); 
    visibleStart = visibleValues[0]; 
    visibleEnd = visibleValues[1]; 
} 
  
private void SetCurrentZoomPosition() 
{ 
    var start = (double)Data[0].XValue; 
    var end = (double)Data[Data.Count - 1].XValue; 
    double delta = GetDelta(start, end); 
    xAxis.ZoomPosition = (visibleStart - start) / delta; 
    xAxis.ZoomFactor = (visibleEnd - visibleStart) / delta; 
} 
 
Note:  This workaround worked on latest volume 3 release (15.3.0.26) only.
 
Sample: http://www.syncfusion.com/downloads/support/forum/132036/ze/Sample1612023583  

Thanks,
Manivannan E 


Loader.
Live Chat Icon For mobile
Up arrow icon