compatibleChartTypesForShape function

List<ChartType> compatibleChartTypesForShape(
  1. ChartSeriesDataShape shape, {
  2. bool registeredOnly = true,
})

Suggest chart types that can consume a series with shape.

Implementation

List<ChartType> compatibleChartTypesForShape(
  ChartSeriesDataShape shape, {
  bool registeredOnly = true,
}) {
  if (shape == ChartSeriesDataShape.unknown) return const [];

  final out = <ChartType>[];
  final candidates = registeredOnly
      ? ChartRegistry.registeredEnums
      : allChartsBundle.registrations.map((r) => r.type);

  for (final type in candidates) {
    if (!chartTypeSupportsSeriesShape(type, shape)) continue;
    if (!out.contains(type)) out.add(type);
  }
  return out;
}