trackballInfo method

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

Implementation

@override
TrackballInfo? trackballInfo(Offset position, int pointIndex) {
  if (pointIndex != -1 && segmentRect != null) {
    final CartesianChartPoint<D> chartPoint = _chartPoint();
    Offset preferredPos;
    if (points.isNotEmpty) {
      preferredPos = Offset(
          series.pointToPixelX(x, high), series.pointToPixelY(x, high));
    } else {
      preferredPos =
          Offset(series.pointToPixelX(x, top), series.pointToPixelX(x, top));
    }
    return ChartTrackballInfo<T, D>(
      position: preferredPos,
      highXPos: preferredPos.dx,
      highYPos: series.pointToPixelY(x, high),
      lowYPos: series.pointToPixelY(x, bottom),
      point: chartPoint,
      series: series,
      seriesIndex: series.index,
      segmentIndex: currentSegmentIndex,
      pointIndex: pointIndex,
      text: series.trackballText(chartPoint, series.name),
      header: series.tooltipHeaderText(chartPoint),
      color: fillPaint.color == Colors.transparent
          ? strokePaint.color
          : fillPaint.color,
    );
  }
  return null;
}