maximumLabelWidth property
Specifies maximum text width for axis labels.
If an axis label exceeds the specified width, it will get trimmed and ellipse(...) will be added at the end of the trimmed text. By default, the labels will not be trimmed.
Complete label text will be shown in a tooltip when tapping/clicking over the trimmed axis labels.
Defaults to null
.
Widget build(BuildContext context) {
return Container(
child: SfCartesianChart(
primaryXAxis: CategoryAxis(maximumLabelWidth: 80),
series: [
BarSeries<ChartData, String>(
dataSource: <ChartData>[
ChartData(x: 'Goldin Finance 117', y: 597),
ChartData(x: 'Ping An Finance Center', y: 599),
ChartData(x: 'Makkah Clock Royal Tower', y: 601),
ChartData(x: 'Shanghai Tower', y: 632),
ChartData(x: 'Burj Khalifa', y: 828)
],
xValueMapper: (ChartData sales, _) => sales.x,
yValueMapper: (ChartData sales, _) => sales.y
)
],
)
);
}
Implementation
final double? maximumLabelWidth;