xxxxxxxxxx
const chartOptions = {
legend: {
display: false
},
// Other chart options...
};
// Example usage:
const ctx = document.getElementById('myChart').getContext('2d');
const myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: [ ],
datasets: [ ]
},
options: chartOptions
});
xxxxxxxxxx
// It's now in plugins options
// See at https://www.chartjs.org/docs/latest/configuration/legend.html
const myChart = new Chart(ctx, {
type: 'line',
data: data,
options: {
plugins: {
legend: {
display: false
}
}
}
})
xxxxxxxxxx
var myChart = new Chart(ctx, {
type: 'line',
data: data,
options: {
legend: {
display: false //This will do the task
}
}
});