handleLegendItemTapped method
void
handleLegendItemTapped(
- LegendItem item,
- bool isToggled
)
override
Implementation
@override
void handleLegendItemTapped(LegendItem item, bool isToggled) {
super.handleLegendItemTapped(item, isToggled);
final ChartLegendItem legendItem = item as ChartLegendItem;
final int toggledIndex = legendItem.pointIndex;
if (toggledIndex < segments.length) {
segmentAt(toggledIndex).isVisible = !isToggled;
}
canUpdateOrCreateSegments = true;
legendItem.onToggled?.call();
markNeedsLayout();
}