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

0
0

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?

Version
2.5.0.946
  • You must to post comments
0
0

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.

  • Lazar Nikolov
    I’ve tried with Radius 1/3/5/10/30 but it still returns “true” when checking the “match” property.
  • Andriy Shkinder
    Even using HitTestPointModeAtX instead of HitTestInterpolateModeAtX?
  • Lazar Nikolov
    Yes. Still getting all of the series matching.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.