AreaChartConfig.fromJson constructor
AreaChartConfig.fromJson(
- Map<String, dynamic> json
)
Implementation
factory AreaChartConfig.fromJson(Map<String, dynamic> json) {
final series = json['series'] != null
? (json['series'] as List).map((s) => Series.fromJson(s)).toList()
: <Series>[];
/* String? areaColor;
if (json['areaColor'] != null) {
final color = ;
if (color is String && color.startsWith('#')) {
areaColor = Color(int.parse('0xFF${color.substring(1)}'));
}
} */
return AreaChartConfig(
series: series,
xAxis: json['xAxis'] != null ? XYAxis.fromJson(json['xAxis']) : null,
yAxis: json['yAxis'] != null ? XYAxis.fromJson(json['yAxis']) : null,
maxY: json['maxY']?.toDouble(),
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,
theme: ChartTheme.fromJson(json['theme']),
xAxisConfig: ChartAxisConfig.fromJson(json['xAxisConfig']),
yAxisConfig: ChartAxisConfig.fromJson(json['yAxisConfig']),
curveSmoothness: json['curveSmoothness']?.toDouble() ?? 0.2,
showDots: json['showDots'] ?? true,
dotSize: json['dotSize']?.toDouble() ?? 4.0,
areaColor: json['areaColor']?.toString() ?? 'red',
areaOpacity: json['areaOpacity']?.toDouble() ?? 0.2,
gradientArea: json['gradientArea'] ?? true,
);
}