We have a graph surface with some point markers on it and we want to show a custom tooltip every time the user taps on a point marker. So far I’ve used a UITapGestureRecognizer, convert the touchpoint in the chart frame and for each of the renderable series perform a HitTestAtX with a radius (I’ve tried 1, 5 and 30) but it always returns true, even if I tap on an area where there’s a gap in the chart. Here’s some sample code:
SCIHitTestInfo hitTestInfo = renderableSeries.HitTestProvider.HitTestInterpolateModeAtX(touchPoint.X, touchPoint.Y, 30, renderableSeries.CurrentRenderPassData);
if (hitTestInfo.match)
{
Console.WriteLine($"Tapped {hitTestInfo.xValue} {hitTestInfo.yValue} with index {hitTestInfo.index} of the series {renderableSeries.DataSeries.SeriesName}");
var elementSeries = Model.BottomRightLegendList.FirstOrDefault(tup => tup.DataSeries.SeriesName == renderableSeries.DataSeries.SeriesName);
var element = elementSeries.GraphElement;
if (element != null)
{
matchedElements.Add(element);
}
}
Why is the “match” property always true, even if there are no Point Markers in the radius?
- Lazar Nikolov asked 5 years ago
- You must login to post comments
Hello, Lazar.
This is happening because you are using hit test with interpolation, if you want to hit test exact point please use HitTestPointModeAtX instead of HitTestInterpolateModeAtX, also manipulate radius value to reach desired accuracy.
- Andriy Shkinder answered 5 years ago
-
I’ve tried with Radius 1/3/5/10/30 but it still returns “true” when checking the “match” property.
-
Even using HitTestPointModeAtX instead of HitTestInterpolateModeAtX?
-
Yes. Still getting all of the series matching.
- You must login to post comments
Please login first to submit.