dataSource property
Data required for rendering the series. If no data source is specified, empty chart will be rendered without series.
Defaults to null
.
Widget build(BuildContext context) {
return SfCartesianChart(
series: <ColumnSeries<SalesData, num>>[
ColumnSeries<SalesData, num>(
dataSource: chartData,
xValueMapper: (SalesData sales, _) => sales.x,
yValueMapper: (SalesData sales, _) => sales.y,
),
],
);
}
final List<SalesData> chartData = <SalesData>[
SalesData(1, 23),
SalesData(2, 35),
SalesData(3, 19)
];
class SalesData {
SalesData(this.x, this.y);
final double x;
final double y;
}
Implementation
final List<T>? dataSource;