FunctionPlotConfig.fromJson constructor
FunctionPlotConfig.fromJson(
- Map<String, dynamic> j
)
Implementation
factory FunctionPlotConfig.fromJson(Map<String, dynamic> j) {
final fns = (JsonValue.mapList(j['functions']) ?? const [])
.map(FunctionSeries.fromJson)
.toList();
return FunctionPlotConfig(
functions: fns,
xMin: JsonValue.doubleOrNull(j['xMin']) ?? -10,
xMax: JsonValue.doubleOrNull(j['xMax']) ?? 10,
yMin: JsonValue.doubleOrNull(j['yMin']) ?? -10,
yMax: JsonValue.doubleOrNull(j['yMax']) ?? 10,
resolution: math.max(1, JsonValue.intOrNull(j['resolution']) ?? 400),
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,
);
}