sortFieldValueMapper property
Field in the data source, which is considered for sorting the data points.
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,
sortFieldValueMapper: (SalesData sales, _) => sales.x,
),
],
);
}
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
@override
final ChartIndexedValueMapper<dynamic>? sortFieldValueMapper;