1

I am using the Radar chart from Chart.js and I want to hide the legend(label) I did this:

new Chart("myChart", {
            type: "radar",
            data: data,
            options: {
                legend:{
                    display: false,
                },
               }
          });

But is not working for some reasons also checked those: Removing legend on charts with chart.js v2 Removing legend on charts with chart.js v2 I'm doing the same but not working

Mariem
  • 63
  • 8

1 Answers1

2

As described in the migration guide (https://www.chartjs.org/docs/master/getting-started/v3-migration.html#specific-changes) the legend has been moved to the plugins namespace so you will need to put it like so:

new Chart("myChart", {
    type: "radar",
    data: data,
    options: {
        plugins: {
            legend: {
                display: false,
            },
        }
    }
});
LeeLenalee
  • 27,463
  • 6
  • 45
  • 69