buildLegendItems method
Builds the legend item.
Implementation
@override
List<LegendItem>? buildLegendItems(int index) {
if (isVisibleInLegend) {
final LegendItem legendItem = ChartLegendItem(
text: legendItemText ?? name,
iconType: toLegendShapeMarkerType(legendIconType, this),
iconColor: legendIconColor(),
iconBorderColor: legendIconBorderColor(),
iconBorderWidth: legendIconBorderWidth(),
series: this,
seriesIndex: index,
pointIndex: 0,
isToggled: _isToggled(),
shader: legendIconShader(),
overlayMarkerType: markerSettings.isVisible
? toShapeMarkerType(markerSettings.shape)
: null,
imageProvider: legendIconType == LegendIconType.image
? parent?.legend?.image
: null,
onTap: handleLegendItemTapped,
onRender: _handleLegendItemCreated,
);
return <LegendItem>[legendItem];
} else {
return null;
}
}