victorgarciaesgi / vue-chart-3

📊 A simple wrapper around Chart.js 3 for Vue 2 & 3

Home Page:https://vue-chart-3.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error with demo Vue 2 + composition API

scil opened this issue · comments

commented

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

commented

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);
commented

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);