Forum Xamarin.Forms

Telerik Chart Control Eating ScrollView's scroll

I am using Telerik's chart control, TKChart (for the iOS native control), and it seems to be swallowing the pan and tap gestures. I have embedded it in a scrollview to support scrolling on the entire view but when a user drags on the chart itself the scroll view never receives the gesture. I understand this is because TKChart handles some input like taps and scrolling but I was wondering if there was a workaround where I could hook up a PanGestureHandler and handle those myself but pass TapGestureHandlers to the chart so that I could scroll the graph page, but also allow the chart to handle the taps for Tooltips within the chart.

I've tried creating a gesture handler and attaching to the parent View and it never fires in the above case. Any ideas?

I posted this originally in the iOS forum but it seems to belong here.

Best Answer


  • NMackayNMackay GBInsider, University admin

    Best bet is the Telerik forum or post a support ticket.

    The Telerik chart handles pinch and zoom so these gesture will be swallowed I'd reckon, Assuming your talking about a Forms app, they do have reneders for more low level stuff but that's really not documented.

  • BryceBrooks.6007BryceBrooks.6007 USMember
    edited February 2018

    Thanks I found something on Telerik just now that says I can do it at a lower level so I am going to try to go down this road, but my experience with custom renderers is limited.

    Unfortunately Xamarin won't let me post the link here...[slash]forums[slash]tkchart-in-a-uiscrollview-can't-scroll
    [scrollView addSubview:_chart];
    UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)];
    [scrollView addGestureRecognizer:tapRecognizer];

    (void)tap:(UITapGestureRecognizer *)gestureRecognizer
    CGPoint touchPoint = [gestureRecognizer locationInView:_chart.plotView];
    TKChartSelectionInfo *hitTestInfo = [_chart hitTestForPoint:touchPoint];
    [_chart select:hitTestInfo];

  • Thanks for posting I believe that is the case. I just found a link that has a workaround... basically add a native gesture recognizer in the ViewDidLoad and manually calling the Chart selector when they tap. Not allowing the Chart to automatically consume these events.

    Would I be able to do that in a custom PageRenderer for that specific page? I'm trying to figure out how to get the UIScrollView that is created within that page renderer as well as the TKChart that is created. I wonder if I am trying to go about this the wrong way.

  • Here's the link (Xamarin won't let me post it for some reason)...

Sign In or Register to comment.