I have a categorization doughnut chart, where I display labels for each category fraction. The problem is that the labels are overlapping each other if the portion on the chart is very small.
If I set labelIntersectAction: LabelIntersectAction.hide,
, most of the labels are not visible (See in the 2nd screenshot), which left the user wondering about the categorization.
Here is my code:
DoughnutSeries<ExpenseCategoryChartData, String>(
dataSource: _chartData,
radius: '65%',
innerRadius: '75%',
opacity: 0.5,
pointColorMapper: (ExpenseCategoryChartData data, _) =>
data.bgColor,
xValueMapper: (ExpenseCategoryChartData data, _) => '${data.x}',
yValueMapper: (ExpenseCategoryChartData data, _) => data.y,
enableSmartLabels: true,
enableTooltip: true,
sortingOrder: SortingOrder.ascending,
dataLabelMapper: (data, __) => '${data.x}',
dataLabelSettings: DataLabelSettings(
// Renders the data label
isVisible: true,
labelIntersectAction: LabelIntersectAction.none,
labelAlignment: ChartDataLabelAlignment.top,
connectorLineSettings: ConnectorLineSettings(
length: '10',
type: ConnectorType.curve,
width: 2,
),
labelPosition: ChartDataLabelPosition.outside,
),
),