createLegend method
void
createLegend()
Implementation
void createLegend() {
if (!options.useLegend) return;
var graphStyle = options.graphStyle;
for (var i = legendCount; i < graph.allTags.length; i++) {
var tag = graph.allTags[i];
add(
RectangleComponent.fromRect(
Rect.fromLTWH(40, 50.0 + 30 * i, 30, 18),
paint: Paint()
..color = graphStyle.colorByTag(tag, graph.allTags) ??
(i < graphStyle.tagColorByIndex.length
? graphStyle.tagColorByIndex[i]
: graphStyle.defaultColor()[0]),
),
);
add(TextComponent(text: tag, position: Vector2(40 + 40, 44.0 + 30 * i)));
legendCount = i;
}
}