iosxamarin.iosscichart

SciChart Xamarin.iOS: PointMarker Tap Event


Is it possible to capture the tap event when we tap on a point marker or a data point? I can see there’s a DataPointSelectionModifier for WPF, but there’s nothing for iOS. Our goal is to show a popup (tooltip) on the point marker when the user taps on it.

Thanks, Lazar Nikolov

Xamarin.iOS Package Version: 2.2.2.854


Solution

  • The API you are looking for is called the Hit-Test API.

    In the latest (sciChart iOS v3) the documentation link is here:

    private void HandleSingleTap(UITapGestureRecognizer recognizer)
    {
        // The touch point relative to the SCIChartSurface
        var location = recognizer.LocationInView(recognizer.View.Superview);
        // Translate the touch point relative to RenderableSeriesArea (or ModifierSurface)
        var hitTestPoint = SciChartSurface.TranslatePoint(location, Surface.RenderableSeriesArea);
        // Perform `Hit-Test` which will be stored in the `_hitTestInfo`
        renderableSeries.HitTest(_hitTestInfo, hitTestPoint);
    }
    

    We also have an example showing how to use the Hit-Test API here. It is Swift but the principles in Xamarin are the same.

    enter image description here