ChartConfig.fromJson constructor

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

Implementation

factory ChartConfig.fromJson(Map<String, dynamic> json) {
  final series = (JsonValue.list(json['series']) ?? const [])
      .map(Series.fromJson)
      .toList();
  return ChartConfig(
    title: json['title'] != null ? TitlesData.fromJson(json['title']) : null,
    tooltip: json['tooltip'] != null
        ? ChartTooltip.fromJson(json['tooltip'])
        : null,
    type: json['type'] != null
        ? getChartType(json['type'])
        : getChartType("line"),
    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,
    xAxis: json['xAxis'] != null ? XYAxis.fromJson(json['xAxis']) : null,
    yAxis: json['yAxis'] != null ? XYAxis.fromJson(json['yAxis']) : null,
    series: series,
  );
}