trackballInfo method

  1. @override
TrackballInfo? trackballInfo(
  1. Offset position,
  2. int pointIndex
)
override

Implementation

@override
TrackballInfo? trackballInfo(Offset position, int pointIndex) {
  if (pointIndex != -1 && _highPoints.isNotEmpty) {
    final int drawPointIndex = drawIndex(pointIndex, _drawIndexes);
    if (drawPointIndex == -1) {
      return null;
    }
    final Offset preferredPos = _highPoints[drawPointIndex];
    if (preferredPos.isNaN) {
      return null;
    }

    final int actualPointIndex = _drawIndexes[drawPointIndex];
    final CartesianChartPoint<D> chartPoint = _chartPoint(actualPointIndex);
    return ChartTrackballInfo<T, D>(
      position: preferredPos,
      highXPos: preferredPos.dx,
      highYPos: preferredPos.dy,
      lowYPos: series.pointToPixelY(chartPoint.xValue!, chartPoint.low!),
      point: chartPoint,
      series: series,
      seriesIndex: series.index,
      segmentIndex: currentSegmentIndex,
      pointIndex: actualPointIndex,
      text: series.trackballText(chartPoint, series.name),
      header: series.tooltipHeaderText(chartPoint),
      color: fillPaint.color,
    );
  }
  return null;
}