SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components


Hi guys,

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.

Lazar Nikolov

  • You must to post comments

For your question Lazar, the API you are looking for is the Hit-Test API.

This is common to all platforms of SciChart.

See SciChart iOS Hit-Test API docs.

// Swift 

 // where anyRenderableSeries is an instance of a SCIRenderableSeriesBase derived type
let hittestResult: SCIHitTestInfo = anyRenderableSeries.hitTestProvider().hitTestAt(x: 100, y: 100, radius: 10, onData: 

// Xamarin.IOS 

// where anyRenderableSeries is an instance of a SCIRenderableSeriesBase derived type
var hittestResult = anyRenderableSeries.HitTestProvider.HitTestAtX(100, 100, 10, anyRenderableSeries.CurrentRenderPassData);

The result of this operation is a HitTestInfo type. This contains info about the X,Y value under the mouse and whether it was clicked on a data-point

 typedef struct {
     BOOL match; // If TRUE then the hit-test was on a data-point 
     int index;
     double x; // The X-Coordinate tapped
     double y; // The Y-Coordinate tapped 
     SCIGenericType xValue; // The XValue under the point
     SCIGenericType yValue; // The YValue under the point
     SCIGenericType xValueInterpolated;
     SCIGenericType yValueInterpolated;
     SCIGenericType y2Value;
     SCIGenericType y2ValueInterpolated;
     SCIGenericType zValue;
     SCIGenericType zValueInterpolated;
     SCIGenericType openValue;
     SCIGenericType highValue;
     SCIGenericType lowValue;
     SCIGenericType closeValue;
     double radius;
 } SCIHitTestInfo;

Let me know if that helps.

We are missing a hit-test example for Xamarin.iOS but the equivalent one in Swift is here.

iOS Chart Hit Test API Example

Best regards

  • Lazar Nikolov
    Hi Andrew. I was following the tutorial on the link that you provided and hit a roadblock when converting the screen tap coordinates to the graph surface coordinates: var touchPoint = bottomGraphSurface.RenderSurface.PointInChartFrame(location); This is the line that fails. It throws an InvalidCastException : System.InvalidCastException: Unable to cast object of type ‘SciChart.iOS.Charting.SCIOpenGLRenderSurface’ of type ‘SciChart.iOS.Charting.SCIRenderSurfaceProtocol’ But when I tried it with Native iOS the same line didn’t throw an exception. I’ve opened a ticket for this.
  • Andrew Burnett-Thompson
    Thanks Lazar, good that you’ve opened a ticket – that will ensure the team sees it. I will also notify the iOS team and ask for their assistance. Best regards, Andrew
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.