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
close icon

Android Chart Scroll

In our app we have an SfChart contained in a scroll view with only vertical scrolling.
We have horizontal (X) panning enabled on the chart. 

On iOS, the chart fully consumes swipe gestures with no cascading to other views. To scroll the scroll view vertically you have to make sure the swipe begins outside of the SfChart in order for the gesture to be recognized

On Android, the chart appears to cascade the gestures and the result is that when a user attempts to pan the graph, if they move their finger slightly in the Y direction then the whole view scrolls vertically - the scroll view is consuming the gesture which makes it very difficult to pan the SfChart content in the X axis; you have to ensure your finger moves only in X

Is there a way of ensuring the Android chart acts consistently with the iOS chart?

Is there a solution to the Android issue other than moving the SfChart outside the scroll view?

Thanks

5 Replies

YP Yuvaraj Palanisamy Syncfusion Team May 20, 2015 12:23 PM UTC

Hi Mark,

Thanks for using syncfusion products,

We would like to let you know that we can change the Android behavior as like iOS in our upcoming service pack release. As of now you can prevent the scrolling of ScrollViewer when using zoom or pan in the Chart by adding the following code in constructor of Android project MainActivity.cs file,
[C#]
Xamarin.Forms.Forms.ViewInitialized += (sender, e) =>
{
if (!(e.NativeView is SfChart)) return;
(e.NativeView as SfChart).Touch += (obj, args) =>
((SfChart) obj).RequestDisallowInterceptTouchEvent(true);

};



We have also prepared the sample for your reference, please find the sample from the following location,


Sample: http://www.syncfusion.com/downloads/support/forum/119182/Scroll_Chart-628208838.zip

Please let us know if you require further assistance on this.

Thanks,
Yuvaraj P



MH Mark Hatton May 20, 2015 12:59 PM UTC

Thanks Yuvaraj,

That works nicely - just a minor correction for other readers: Make sure you insert 'parent' into the code fragment listed:

((SfChart) obj).Parent.RequestDisallowInterceptTouchEvent(true);



MH Mark Hatton May 20, 2015 02:29 PM UTC

We've just noticed another problem with our app not receiving double taps on some Android devices. The good news is that you can use the sample you link to below (Sample: http://www.syncfusion.com/downloads/support/forum/119182/Scroll_Chart-628208838.zip ) to reproduce this:

Install the sample on a Hudl  and double tap on the chart doesn't work at all (no zoom toggle)
On a Nexus 4 / MotoG it works sometimes but is unreliable
On a Nexus 5 it works pretty much flawlessly

We've only seen this issue on Android. On iOS it all seems to work as advertised.

Any ideas?


YP Yuvaraj Palanisamy Syncfusion Team May 21, 2015 12:38 PM UTC

Hi Mark,

Thanks for the update.

We have analyzed the reported issue and we are able to reproduce the issue in our side. We have logged a defect report on this and the fix for this issue will be available on our upcoming service pack release which is expected to release by end of this May 2015.

Please let us know if you require further assistance on this.

Thanks,
Yuvaraj P


YP Yuvaraj Palanisamy Syncfusion Team June 1, 2015 09:27 AM UTC

Hi Mark,

We are glad to announce that our service pack 2 for Volume 1 2015 is rolled out and is available for download under the following link:

http://www.syncfusion.com/forums/119275/essential-studio-2015-volume-1-service-pack-2-release-v13-1-0-30-available-for-download

We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.

Regards,
Yuvaraj P

Loader.
Live Chat Icon For mobile
Up arrow icon