1👍
This is because you are using treeshaking and not importing and registering the subtitle plugin. Adding the import and register like so will resolve the issue:
import {Chart, SubTitle} from 'chart.js';
Chart.register(SubTitle);
Or you can just let chart.js handle it and import and register everything like so:
import Chart from 'chart.js/auto';
- Chartjs-React: reusable component keeps failing (too many renders | value doesn't show | uncaught errors | …)
- Chartjs-React-chartjs error Cannot read property 'Chart' of undefined
Source:stackexchange.com