score:1

Accepted answer

i assume you have your options for the legend in the wrong place:

as described in the migration guide the legend,plugin tooltip and title have been moved to the plugin section.

example:

var options = {
  type: 'line',
  data: {
    labels: ["red", "blue", "yellow", "green", "purple", "orange"],
    datasets: [{
        label: '# of votes',
        data: [12, 19, 3, 5, 2, 3],
        borderwidth: 1
      },
      {
        label: '# of points',
        data: [7, 11, 5, 8, 3, 7],
        borderwidth: 1
      }
    ]
  },
  options: {
    plugins: {
      legend: {
        labels: {
          font: {
            size: 30
          }
        }
      }
    }
  }
}

var ctx = document.getelementbyid('chartjscontainer').getcontext('2d');
new chart(ctx, options);
<body>
  <canvas id="chartjscontainer" width="600" height="400"></canvas>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/chart.js/3.4.0/chart.js"></script>
</body>


Related Query

More Query from same tag