onData method

  1. @override
void onData(
  1. List<MutableSeries<D>> seriesList
)
override

Remove series IDs from the currently hidden list if those series have been removed from the chart data. The goal is to allow any metric that is removed from a chart, and later re-added to it, to be visible to the user.

Implementation

@override
void onData(List<MutableSeries<D>> seriesList) {
  // If a series was removed from the chart, remove it from our current list
  // of hidden series.
  final seriesIds = seriesList.map((series) => series.id);

  _hiddenSeriesList.removeWhere((id) => !seriesIds.contains(id));
}