trackballInfo method

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

Implementation

@override
TrackballInfo? trackballInfo(Offset position) {
  final int nearestPointIndex = _findNearestPoint(_highPoints, position);
  if (nearestPointIndex != -1) {
    final Offset position = points[nearestPointIndex];
    if (position.isNaN) {
      return null;
    }

    final int actualPointIndex = _drawIndexes[nearestPointIndex];
    final CartesianChartPoint<D> chartPoint = _chartPoint(actualPointIndex);
    final num x = _xValues[nearestPointIndex];
    final num high = _highValues[nearestPointIndex];
    final num low = _lowValues[nearestPointIndex];
    return ChartTrackballInfo<T, D>(
      position: points[nearestPointIndex],
      point: chartPoint,
      series: series,
      pointIndex: actualPointIndex,
      seriesIndex: series.index,
      lowYPos: series.pointToPixelY(x, low),
      highYPos: series.pointToPixelY(x, high),
      highXPos: series.pointToPixelX(x, high),
    );
  }
  return null;
}