pointColorMapper property
Field in the data source, which is considered as fill color for the data points.
Defaults to null
.
Widget build(BuildContext context) {
return SfCartesianChart(
series: <ColumnSeries<ColumnColors, num>>[
ColumnSeries<ColumnColors, num>(
dataSource: chartData,
xValueMapper: (ColumnColors sales, _) => sales.x,
yValueMapper: (ColumnColors sales, _) => sales.y,
pointColorMapper: (ColumnColors sales, _) => sales.pointColorMapper,
),
],
);
}
final List<ColumnColors> chartData = <ColumnColors>[
ColumnColors(1991, 7.8, const Color.fromRGBO(0, 0, 255, 1)),
ColumnColors(1992, 6.5, const Color.fromRGBO(255, 0, 0, 1)),
ColumnColors(1993, 6.0, const Color.fromRGBO(255, 100, 102, 1)),
];
class ColumnColors {
ColumnColors(this.x, this.y,this.pointColorMapper);
final num x;
final num y;
final Color pointColorMapper;
}
Implementation
@override
final ChartIndexedValueMapper<Color>? pointColorMapper;