Skip to content

Applying custom formatting logic to PieChart legend values

This demo shows how we can use adapters to apply custom formatting logic to legend labels based on their value.

legend.valueLabels.template.adapters.add("text", function(text, target) {
if (target.dataItem && (target.dataItem.get("valuePercentTotal") < 5)) {
return "<5%";
}
return text;
});
Open in CodePen