getSelectedDatumDetails method

List<DatumDetails<D>> getSelectedDatumDetails(
  1. SelectionModelType selectionModelType
)

Retrieves the datum details for the current chart selection.

selectionModelType specifies the type of the selection model to use.

Implementation

List<DatumDetails<D>> getSelectedDatumDetails(
    SelectionModelType selectionModelType) {
  final details = <DatumDetails<D>>[];

  if (_currentSeriesList == null) {
    return details;
  }

  final selectionModel = getSelectionModel(selectionModelType);
  if (!selectionModel.hasDatumSelection) {
    return details;
  }

  // Pass each selected datum to the appropriate series renderer to get full
  // details appropriate to its series type.
  for (final seriesDatum in selectionModel.selectedDatum) {
    final rendererId = seriesDatum.series.getAttr(rendererIdKey);
    details.add(
        getSeriesRenderer(rendererId).getDetailsForSeriesDatum(seriesDatum));
  }

  return details;
}