This is a migrated thread and some comments may be shown as answers.

Manually turn on tooltip in TKChart

1 Answer 58 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Bryce
Top achievements
Rank 1
Bryce asked on 01 Mar 2018, 04:00 PM

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

 

1 Answer, 1 is accepted

Sort by
0
Tsvyatko
Telerik team
answered on 05 Mar 2018, 09:19 AM
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
Tags
Chart
Asked by
Bryce
Top achievements
Rank 1
Answers by
Tsvyatko
Telerik team
Share this question
or