8👍
✅
The filter function works exactly like the Javascript’s native Array.prototype.filter
. So just return true if you want to show the legend at a particular index.
EDIT: The filter function would come inside the labels
field.
legend: {
display: true,
labels: {
filter: function(legendItem, data) {
return legendItem.index != 1
}
}
}
Source:stackexchange.com