Manually turn on tooltip in TKChart

2 posts, 0 answers
  1. Bryce
    Bryce avatar
    1 posts
    Member since:
    Feb 2017

    Posted 01 Mar 2018 Link to this post

    Hi, I have a chart inside a Scrollview that wasn't scrolling. Based on this thread https://www.telerik.com/forums/tkchart-in-a-uiscrollview-can't-scroll I decided to look into a gesturerecognizer. However, the example shows how to select a point. What I would like is to turn on a tooltip. I have the behavior turned on but can't seem to manually turn on the tooltip itself. The tooltip works fine if I allow the LongPressGesture to resolve normally so that is not the issue. I just need to manually turn it on it seems.

    This code seems to select the point, assuming I set the selection mode properly.

    private void HandleTap(UITapGestureRecognizer tap)
    {
        var touchPoint = tap.LocationInView(Control.PlotView);  // Control is TKChart
        var hitTestInfo = Control.HitTestForPoint(touchPoint);
        Control.Select(hitTestInfo);
    }

     

    How can I turn on the tooltip for that point as if they'd tapped it?

    Thank you,

    Bryce

     

  2. Tsvyatko
    Admin
    Tsvyatko avatar
    863 posts

    Posted 05 Mar 2018 Link to this post

    Hi Bryce,

    Thank you for contacting us! In order to manually show the tool tip you would require the following:

     - setup the trackball behavior to RadCartesianChart. Ii will simplify the tooltip content setup:
    <telerikChart:RadCartesianChart.Behaviors>
        <telerikChart:ChartTrackBallBehavior ShowTrackInfo="true" ShowIntersectionPoints="true"  />
    </telerikChart:RadCartesianChart.Behaviors>

     - add the following code in the tap recognizer:

    public void OnTap(UITapGestureRecognizer recognizer)
    {
         var touchPoint = recognizer.LocationInView(Control.PlotView);  // Control is TKChart
         this.Control.Trackball.ShowAtPoint(touchPoint);
    }


    Let me know if this helps. 

    Regards,
    Tsvyatko
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top