switchChartTypeForSeriesShapeAuto function

Map<String, dynamic> switchChartTypeForSeriesShapeAuto(
  1. Map<String, dynamic> source, {
  2. List<ChartType>? preferredOrder,
  3. bool includeCurrentType = false,
  4. bool registeredOnly = true,
})

Automatically switches source to the highest-ranked compatible chart type for its inferred data shape.

Implementation

Map<String, dynamic> switchChartTypeForSeriesShapeAuto(
  Map<String, dynamic> source, {
  List<ChartType>? preferredOrder,
  bool includeCurrentType = false,
  bool registeredOnly = true,
}) {
  final result = trySwitchChartTypeForSeriesShapeAuto(
    source,
    preferredOrder: preferredOrder,
    includeCurrentType: includeCurrentType,
    registeredOnly: registeredOnly,
  );
  if (!result.success || result.payload == null) {
    throw StateError(result.message);
  }
  return result.payload!;
}