getSelectedDataPoints method
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 = _selectionBehaviorRenderer!._selectionDetails
.stateProperties.chartSeries.visibleSeriesRenderers[0];
SelectionBehaviorRenderer selectionRenderer;
if (seriesRenderer is CartesianSeriesRenderer) {
selectionRenderer = SeriesHelper.getSeriesRendererDetails(seriesRenderer)
.selectionBehaviorRenderer!;
} else {
selectionRenderer = seriesRenderer.selectionBehaviorRenderer;
}
final List<int> selectedPoints = <int>[];
selectedItems =
selectionRenderer._selectionDetails.selectionRenderer!.selectedSegments;
for (int i = 0; i < selectedItems.length; i++) {
selectedPoints.add(selectedItems[i].currentSegmentIndex!);
}
return selectedPoints;
}