2๐
I solved it by adding:
import { Chart } from 'chart.js';
import 'chartjs-adapter-moment';
as pointed out by the doc
- [Chartjs]-How to remove transparency from bar charts?
- [Chartjs]-Chart.js tooltip keeps remembering old data after update
0๐
You need to include Moment.js before Chart.js.
The Chart.js documentation could do a better job of highlighting this, but it is explained on the installation page:
The stand-alone build includes Chart.js as well as the color parsing library. If this version is used, you are required to include Moment.js before Chart.js for the functionality of the time axis.
-1๐
You could try to put the moment.js script above the chart.js. However here is an example of using moment.js that may help you.
- [Chartjs]-React chartjs-2 โ Increase spacing between legend and chart
- [Chartjs]-Remove Canvas then add new Canvas in same spot
Source:stackexchange.com