뷰 최신 버전에서 차트를 불러올려면
강사님께서 올려주신 영상 내용과 달리 다르게 해주어야 한다!
스크립트 밑에 import 를
import {
Chart,
ArcElement,
LineElement,
BarElement,
PointElement,
BarController,
BubbleController,
DoughnutController,
LineController,
PieController,
PolarAreaController,
RadarController,
ScatterController,
CategoryScale,
LinearScale,
LogarithmicScale,
RadialLinearScale,
TimeScale,
TimeSeriesScale,
Decimation,
Filler,
Legend,
Title,
Tooltip,
SubTitle
} from 'chart.js';
Chart.register(
ArcElement,
LineElement,
BarElement,
PointElement,
BarController,
BubbleController,
DoughnutController,
LineController,
PieController,
PolarAreaController,
RadarController,
ScatterController,
CategoryScale,
LinearScale,
LogarithmicScale,
RadialLinearScale,
TimeScale,
TimeSeriesScale,
Decimation,
Filler,
Legend,
Title,
Tooltip,
SubTitle
);
더 간편하게는
import { Chart, registerables } from 'chart.js';
Chart.register(...registerables);
더더 간편하게는
import Chart from 'chart.js/auto';
완전 어썸하다.
이런 내용은 chart.js에 다 있었다!
어썸!
https://www.chartjs.org/docs/latest/getting-started/integration.html