ComboChartConfig.fromJson constructor

ComboChartConfig.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory ComboChartConfig.fromJson(Map<String, dynamic> json) {
  final cats = JsonValue.stringList(json['categories']) ?? const <String>[];
  final comboSeries = (JsonValue.mapList(json['series']) ?? const [])
      .map(ComboSeries.fromJson)
      .toList();
  return ComboChartConfig(
    categories: cats,
    comboSeries: comboSeries,
    showLegend: JsonValue.boolOrNull(json['showLegend']) ?? true,
    barGroupWidthFraction:
        JsonValue.doubleOrNull(json['barGroupWidth']) ?? 0.7,
    dotRadius: JsonValue.doubleOrNull(json['dotRadius']) ?? 4.0,
    title: json['title'] != null ? TitlesData.fromJson(json['title']) : null,
    tooltip: json['tooltip'] != null
        ? ChartTooltip.fromJson(json['tooltip'])
        : null,
    legend: json['legend'] != null
        ? ChartLegend.fromJson(json['legend'])
        : null,
    toolbox: json['toolbox'] != null
        ? ChartToolbox.fromJson(json['toolbox'])
        : null,
    grid: json['grid'] != null ? GridData.fromJson(json['grid']) : null,
  );
}