Ivan Rubinson
Ivan Rubinson

Reputation: 3329

ChartJS 3 doesn't display legend

I'm using ChartJS 3.7 and even when I pass options.plugins.legend.display a true, the legend isn't displayed. How do I get the legend to show?

Upvotes: 1

Views: 675

Answers (1)

Ivan Rubinson
Ivan Rubinson

Reputation: 3329

Looks like newer versions of ChartJS require you to register the individual elements you're going to use. You need to register the legend specifically.

import { Chart, Legend } from 'chart.js';
// ...
Chart.register(Legend);

Upvotes: 1

Related Questions