trackballInfo method

  1. @override
TrackballInfo? trackballInfo(
  1. Offset position
)
override

Implementation

@override
TrackballInfo? trackballInfo(Offset position) {
  final int nearestPointIndex = _findNearestPoint(points, position);
  if (nearestPointIndex != -1) {
    final int segmentIndex = nearestPointIndex == 0
        ? currentSegmentIndex
        : currentSegmentIndex + 1;
    final int pointIndex = clampInt(segmentIndex, 0, series.dataCount - 1);
    final CartesianChartPoint<D> chartPoint = _chartPoint(pointIndex);
    return ChartTrackballInfo<T, D>(
      position: points[nearestPointIndex],
      point: chartPoint,
      series: series,
      pointIndex: currentSegmentIndex,
      seriesIndex: series.index,
    );
  }
  return null;
}