error with demo Vue 2 + composition API
scil opened this issue · comments
Describe the bug
I follow this demo
Vue 2 + composition API: CodeSandbox demo Vue 2 + composition
got error like ERROR Error: "linear" is not a registered scale
how to fix
same error: sgratzl/chartjs-chart-wordcloud#4
chart.js 3 is ESM tree shakeable and requires to register all components that you are going to use. Thus, you have to register the linear scale manually
so add this line
import { Chart, registerables } from 'chart.js';Chart.register(...registerables);
And plugin zoom is also needed.
npm i chartjs-plugin-zoom
import { Chart, registerables } from 'chart.js';
import zoomPlugin from "chartjs-plugin-zoom";
Chart.register(...registerables, zoomPlugin);