setters method
Implementation
@override
Map<String, Function> setters() {
return {
"title": (Object t) => this.controller.title = getString(t),
"labels": (Object mLabels) {
List? metaLabels = getList(mLabels);
if (metaLabels == null) {
throw Exception('LineChart.data must be a list but is not');
}
List<String> labels = [];
for (Object node in metaLabels) {
labels.add(getString(node)!);
}
controller.labels = labels;
},
"properties": (Object mProps) {
Map? metaProps = getMap(mProps);
if (metaProps == null) {
throw Exception(
"Properties cannot be set ot null and must be set to a map");
}
if (metaProps['minY'] == null || metaProps['maxY'] == null) {
throw Exception('both minY and maxY must be specified for lincharts');
}
LineChartProperties props = LineChartProperties(
metaProps['minY'].toDouble(), metaProps['maxY'].toDouble());
if (metaProps['asArea']) {
props.asArea = metaProps['asArea'] as bool;
}
if (metaProps['curved']) {
props.curved = metaProps['curved'] as bool;
}
controller.properties = props;
},
"data": (Object data) {
List? l = getList(data);
if (l == null) {
throw Exception('LineChart.data must be a list but is not');
}
controller.setMetaData(l);
}
};
}