Pre loader

Xamarin.iOS: PointMarker Tap Event

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

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.

Thanks,
Lazar Nikolov

Version
2.2.2.854
  • You must to post comments
0
0

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: 
anyRenderableSeries.currentRenderPassData)

// 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
Andrew

  • 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.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies