Migration from v4 to v5 ​
With v5, this library introduces a number of breaking changes
ESM ​
v5.0 ​
Chart.js v4 and vue-chartjs v5 are ESM-only packages. To use them in your project, it also should be ESM:
json
// package.json
{
"type": "module"
}
If you are experiencing this problem with Jest, you should follow this doc to enable ESM support. Or, we can recommend you migrate to Vitest. Vitest has ESM support out of the box and has almost the same API as Jest. Here is our example of migration.
v5.1 ​
Chart.js v4.1 and vue-chartjs v5.1 have restored the CommonJS support.
API changes ​
chartData
props were renamed todata
chartOptions
props were renamed tooptions
- unknown props will fall through to the canvas element.
generateChart
were refactored and renamed tocreateTypedChart
- Vue.js < 2.7 is no longer supported. If you want to use vue-chartjs with Vue < 2.7 you have to lock your version to 4.x.