onLegendTapped property

ChartLegendTapCallback? onLegendTapped
final

Occurs when the legend is tapped. Here, you can get the series, series index, and point index.

Widget build(BuildContext context) {
   return Container(
       child: SfCircularChart(
           onLegendTapped: (LegendTapArgs args) => legend(args),
       ));
}
void legend(LegendTapArgs args) {
  print(args.pointIndex);
}

Implementation

final ChartLegendTapCallback? onLegendTapped;