pointColorMapper property
Maps the field name, which will be considered as x-values.
Defaults to null
Widget build(BuildContext context) {
return Container(
child: SfCircularChart(
series: <PieSeries<ChartData, String>>[
PieSeries<ChartData, String>(
dataSource: <ChartData>[
ChartData('USA', 10, Colors.red),
ChartData('China', 11, Colors.green),
ChartData('Russia', 9, Colors.blue),
ChartData('Germany', 10, Colors.voilet),
],
pointColorMapper: (ChartData data, _) => data.pointColor,
),
],
));
}
class ChartData {
ChartData(this.xVal, this.yVal, [this.pointColor]);
final String xVal;
final int yVal;
final Color pointColor;
}
Implementation
@override
final ChartIndexedValueMapper<Color>? pointColorMapper;