getSelectedDataPoints method

List<int> getSelectedDataPoints(
  1. CartesianSeries _series
)

provides the list of selected point indices for given series.

Implementation

List<int> getSelectedDataPoints(CartesianSeries<dynamic, dynamic> _series) {
  List<ChartSegment> selectedItems = <ChartSegment>[];
  final dynamic seriesRenderer =
      _chartState._chartSeries.visibleSeriesRenderers[0];
  final SelectionBehaviorRenderer selectionBehaviorRenderer =
      seriesRenderer._selectionBehaviorRenderer;
  final List<int> selectedPoints = <int>[];
  selectedItems =
      selectionBehaviorRenderer._selectionRenderer!.selectedSegments;
  for (int i = 0; i < selectedItems.length; i++) {
    selectedPoints.add(selectedItems[i].currentSegmentIndex!);
  }
  return selectedPoints;
}