Files
ojnext/src/shared/composables/chart.ts
2023-02-10 10:19:43 +08:00

29 lines
404 B
TypeScript

import {
Chart as ChartJS,
Title,
Colors,
Tooltip,
Legend,
BarElement,
ArcElement,
CategoryScale,
LinearScale,
} from "chart.js"
const [isLoaded] = useToggle()
export function loadChart() {
if (isLoaded.value) return
ChartJS.register(
CategoryScale,
LinearScale,
BarElement,
ArcElement,
Colors,
Title,
Tooltip,
Legend
)
isLoaded.value = true
}