dataLabelMapper property
Field in the data source, which is considered as text for the data points.
Defaults to null
.
Widget build(BuildContext context) {
return SfCartesianChart(
series: <BarSeries<SalesData, num>>[
BarSeries<SalesData, num>(
dataSource: <SalesData>[
SalesData(DateTime(2005, 0, 1), 'India', 16),
SalesData(DateTime(2006, 0, 1), 'China', 12),
SalesData(DateTime(2007, 0, 1), 'USA',18),
],
dataLabelSettings: DataLabelSettings(isVisible:true),
dataLabelMapper: (SalesData data, _) => data.dataLabelText,
),
],
);
}
class SalesData {
SalesData(this.year, this.dataLabelText, this.sales1);
final DateTime year;
final String dataLabelText;
final int sales1;
}
Implementation
final ChartIndexedValueMapper<String>? dataLabelMapper;