fix chartjs register

This commit is contained in:
xuyue committed 2025-10-04 13:29:13 +08:00
1 parent a823cb7a13
commit ef0b0c5528
4 files changed
+41 -31

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
import {
ArcElement,
BarElement,
BarController,
CategoryScale,
Chart as ChartJS,
Colors,
Legend,
LinearScale,
LineController,
Title,
Tooltip,
LineElement,
PointElement,
} from "chart.js"
let registered = false
export function registerChart() {
if (registered) return
ChartJS.register(
CategoryScale,
LinearScale,
BarElement,
BarController,
ArcElement,
LineElement,
LineController,
PointElement,
Colors,
Title,
Tooltip,
Legend,
)
registered = true
}