Removing legend on charts with chart.js v2
From chart.js version 2.x backwards:
The options object can be added to the chart when the new Chart object is created.
var chart1 = new Chart(canvas, {
type: "pie",
data: data,
options: {
legend: {
display: false
},
tooltips: {
enabled: false
}
}
});
From chart.js version 3.x onwards:
legend, title and tooltip namespaces are moved from options to options.plugins
.
var chart1 = new Chart(canvas, {
type: "pie",
data: data,
options: {
plugins: {
legend: {
display: false
},
}
}
});