LineGradientChartConfig.fromJson constructor

LineGradientChartConfig.fromJson(
  1. Map<String, dynamic> j
)

Implementation

factory LineGradientChartConfig.fromJson(Map<String, dynamic> j) {
  final cats =
      JsonValue.stringList(j['categories']) ??
      JsonValue.stringList(j['xLabels']) ??
      const <String>[];
  return LineGradientChartConfig(
    categories: cats,
    series: _lineVariantSeries(j['series']),
    gradientStart: JsonValue.string(j['gradientStart']) ?? '#42A5F5',
    gradientEnd: JsonValue.string(j['gradientEnd']) ?? '#26C6DA',
    fillArea: JsonValue.boolOrNull(j['fillArea']) ?? true,
    fillOpacity: JsonValue.doubleOrNull(j['fillOpacity']) ?? 0.25,
    title: j['title'] != null ? TitlesData.fromJson(j['title']) : null,
    tooltip: j['tooltip'] != null
        ? ChartTooltip.fromJson(j['tooltip'])
        : null,
    legend: j['legend'] != null ? ChartLegend.fromJson(j['legend']) : null,
    toolbox: j['toolbox'] != null
        ? ChartToolbox.fromJson(j['toolbox'])
        : null,
    grid: j['grid'] != null ? GridData.fromJson(j['grid']) : null,
  );
}