0👍
This works for me:
multiLineChart.legend.legendItems[0].hidden = true;
multiLineChart.data.datasets[0].hidden = true;
For some reason the update method didn’t quite work, but this did:
function init() {
myBarChart = new Chart(ctx, {
type: chartType,
data: data,
options: options
});
myBarChart.legend.legendItems[0].hidden = true;
myBarChart.data.datasets[0].hidden = true;
}
And your function:
multiLineChart.legend.legendItems.forEach(function(label, key) {
multiLineChart.legend.legendItems[key].hidden = true;
multiLineChart.data.datasets[key].hidden = true;
});
Codepen: Chart.js Pre Crossed Series
Source:stackexchange.com