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),
           legend: Legend(isVisible: true),
       )
   );
}
void legend(LegendTapArgs args) {
  print(args.pointIndex);
}

Implementation

final ChartLegendTapCallback? onLegendTapped;