Skip to content

Using series color for legend labels

This demo shows how we can make labels of a legend on an XY chart take the color of their corresponding series.

legend.labels.template.events.on("dataitemchanged", function(ev) {
const series = ev.target.dataItem.component;
ev.target.set("fill", series.get("fill"));
});
Open in CodePen