7👍
you can try this
type: 'time' as const,
time: {
unit: 'month' as const,
},
1👍
I have the same problem at the moment. I have found this article (https://blog.devgenius.io/using-chart-js-with-react-to-create-a-line-chart-showing-progress-over-time-3e34377b1391) suggesting to move the type- and the time option into the adapter options like this:
adapters: {
date: { locale: enGB },
type: "time",
time: {
unit: "month",
},
},
But unfortunately the options are not applied properly, so maybe there are more steps missing…
Edit:
It seems like the graph-options/the adapter don’t go along well with typescript, so I could solve the issue by ignoring typescript for the file with the graph by simply adding
// @ts-nocheck
at the beginning of the file. I don’t know if this is the best solution but at least the graph works now as expected.
0👍
First you need to remove the beginAtZero: false
since that only applies to linear scales and is conflicting with the time scale and thus it will give an error. And from the error it seems likely you dont have a date adapter installed. This is necesarry for the time scale and typings to work.
https://www.chartjs.org/docs/master/axes/cartesian/time.html#date-adapters
- [Chartjs]-Move tooltip further from data point for Chart.js?
- [Chartjs]-Hiding labels on y axis in Chart.js