Here are some errors that I faced while implementing the bar chart and doughnut chart.
These errors occur due to incompatibility between the version of Chart.js being used and the version of ‘react-chartjs-2’.
Issue 01:
-> Error: "bar" is not a registered element.
-> Solution: import { BarElement } from 'chart.js';
Then register this element.
ChartJS.register(
BarElement
);
Issue 02:
-> Error:"arc" is not a registered element.
-> Solution: import { ArcElement } from 'chart.js';
Then register this element.
ChartJS.register(
ArcElement,
);
By the way, you have done grate job @Szymon, short and simple to understand.