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
- Lazar Nikolov asked 6 years ago
-
Hi Lazar, Your trial has expired on 9th Nov hence our team is not answering. Have you purchased a SciChart license or continued to trial using an extension? If so let me know, we will be happy to help. Best regards, Andrew
-
Yes we do have a license purchased, for both iOS and Android.
-
OK. If you could activate it – it will show as active in the forums. see http://www.scichart.com/licensing-scichart-ios
- You must login 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:
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
- Andrew Burnett-Thompson answered 6 years ago
-
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.
-
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 login to post comments
Please login first to submit.