segmentPointIndex method

  1. @override
int segmentPointIndex(
  1. Offset position,
  2. ChartSegment segment
)
inherited

Implementation

@override
int segmentPointIndex(Offset position, ChartSegment segment) {
  final int length = segment.points.length;
  for (int i = 0; i < length; i++) {
    final Rect bounds = Rect.fromCenter(
        center: segment.points[i],
        width: tooltipPadding,
        height: tooltipPadding);
    if (bounds.contains(position)) {
      return i;
    }
  }
  return -1;
}