WaterfallChartConfig.fromJson constructor
WaterfallChartConfig.fromJson(
- Map<String, dynamic> json
)
Implementation
factory WaterfallChartConfig.fromJson(Map<String, dynamic> json) {
final items = ChartSeriesJson.firstSeriesData(
json['series'],
).map(WaterfallItem.fromJson).toList();
return WaterfallChartConfig(
items: items,
showConnectors: JsonValue.boolOrNull(json['showConnectors']) ?? true,
showLabels: JsonValue.boolOrNull(json['showLabels']) ?? true,
showRunningTotal: JsonValue.boolOrNull(json['showRunningTotal']) ?? false,
increaseColor: ChartColorValue.colorOrFallback(
json['increaseColor'],
const Color(0xFF4CAF50),
),
decreaseColor: ChartColorValue.colorOrFallback(
json['decreaseColor'],
const Color(0xFFF44336),
),
totalColor: ChartColorValue.colorOrFallback(
json['totalColor'],
const Color(0xFF2196F3),
),
barWidthFraction:
JsonValue.doubleOrNull(json['barWidthFraction']) ?? 0.65,
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,
);
}