buildShapeBundles function

Implementation

Map<ChartSeriesDataShape, RegistrationBundle> buildShapeBundles() {
  RegistrationBundle make(
    ChartSeriesDataShape shape,
    String name,
    String description,
    Set<ChartType> allowed,
  ) {
    final regs = allChartsBundle.registrations
        .where((r) => allowed.contains(r.type))
        .toList();
    return RegistrationBundle(
      name: name,
      description: '$description (${shape.name})',
      registrations: regs,
    );
  }

  return {
    ChartSeriesDataShape.cartesian: make(
      ChartSeriesDataShape.cartesian,
      'shape_cartesian',
      'Charts for category/time/value series',
      cartesianTypes,
    ),
    ChartSeriesDataShape.pieLike: make(
      ChartSeriesDataShape.pieLike,
      'shape_pie',
      'Charts for label/value slices',
      pieLikeTypes,
    ),
    ChartSeriesDataShape.hierarchical: make(
      ChartSeriesDataShape.hierarchical,
      'shape_hierarchical',
      'Charts for tree/hierarchy data',
      hierarchicalTypes,
    ),
    ChartSeriesDataShape.matrix: make(
      ChartSeriesDataShape.matrix,
      'shape_matrix',
      'Charts for matrix/grid value data',
      matrixTypes,
    ),
    ChartSeriesDataShape.graph: make(
      ChartSeriesDataShape.graph,
      'shape_graph',
      'Charts for node-link graph data',
      graphTypes,
    ),
    ChartSeriesDataShape.flow: make(
      ChartSeriesDataShape.flow,
      'shape_flow',
      'Charts for flow/process data',
      flowTypes,
    ),
    ChartSeriesDataShape.financial: make(
      ChartSeriesDataShape.financial,
      'shape_financial',
      'Charts for OHLC/trading data',
      financialTypes,
    ),
    ChartSeriesDataShape.radial: make(
      ChartSeriesDataShape.radial,
      'shape_radial',
      'Charts for radial/polar metrics',
      radialTypes,
    ),
    ChartSeriesDataShape.calendar: make(
      ChartSeriesDataShape.calendar,
      'shape_calendar',
      'Charts for date-bucketed activity',
      calendarTypes,
    ),
    ChartSeriesDataShape.geospatial: make(
      ChartSeriesDataShape.geospatial,
      'shape_geo',
      'Charts for region/value map data',
      geoTypes,
    ),
  };
}