I need to select a point on QChart Series.
Based on this example, I’m able to capture a click on the series:
QObject::connect(series, &QXYSeries::clicked, series, [=](const QPointF &point) {
int index = series->points().indexOf(point);
if (index != -1)
series->toggleSelection({index});
});
The problem is that the point passed as parameter of the lambda is never accurate enough to match a point in the series.
For example, it can be QPointF (481.461, 77007.3) while the closest in series is {482, 77000}.
Is there a way to set a kind of tolerance in pixels for example to catch the closest point within this tolerance?
My data amplitude is pretty bi (0 to 130 000).