showByIndex method

void showByIndex(
  1. int pointIndex
)

Displays the crosshair at the specified point index.

pointIndex - index of point at which the crosshair needs to be shown.

Implementation

void showByIndex(int pointIndex) {
  final RenderBehaviorArea? parent = parentBox as RenderBehaviorArea?;
  if (parent != null && parent.plotArea != null) {
    final XyDataSeriesRenderer? seriesRenderer =
        parent.plotArea!.firstChild as XyDataSeriesRenderer?;
    if (seriesRenderer != null) {
      final List<num> visibleIndexes = seriesRenderer.visibleIndexes;
      if (visibleIndexes.first <= pointIndex &&
          pointIndex <= visibleIndexes.last) {
        show(seriesRenderer.xRawValues[pointIndex],
            seriesRenderer.yValues[pointIndex].toDouble());
      }
    }
  }
}