2023-07-07 19:22:30 +00:00
|
|
|
import {
|
2023-07-23 13:31:28 +00:00
|
|
|
Chart,
|
|
|
|
ArcElement,
|
|
|
|
LineElement,
|
|
|
|
BarElement,
|
|
|
|
PointElement,
|
|
|
|
BarController,
|
|
|
|
LineController,
|
|
|
|
DoughnutController,
|
|
|
|
CategoryScale,
|
|
|
|
LinearScale,
|
|
|
|
TimeScale,
|
|
|
|
Legend,
|
|
|
|
Title,
|
|
|
|
Tooltip,
|
|
|
|
SubTitle,
|
|
|
|
Filler,
|
2023-07-07 19:22:30 +00:00
|
|
|
} from "chart.js";
|
|
|
|
import gradient from "chartjs-plugin-gradient";
|
|
|
|
import zoomPlugin from "chartjs-plugin-zoom";
|
|
|
|
import { MatrixController, MatrixElement } from "chartjs-chart-matrix";
|
|
|
|
import { defaultStore } from "@/store";
|
|
|
|
import "chartjs-adapter-date-fns";
|
|
|
|
|
|
|
|
export function initChart() {
|
2023-07-23 13:31:28 +00:00
|
|
|
Chart.register(
|
|
|
|
ArcElement,
|
|
|
|
LineElement,
|
|
|
|
BarElement,
|
|
|
|
PointElement,
|
|
|
|
BarController,
|
|
|
|
LineController,
|
|
|
|
DoughnutController,
|
|
|
|
CategoryScale,
|
|
|
|
LinearScale,
|
|
|
|
TimeScale,
|
|
|
|
Legend,
|
|
|
|
Title,
|
|
|
|
Tooltip,
|
|
|
|
SubTitle,
|
|
|
|
Filler,
|
|
|
|
MatrixController,
|
|
|
|
MatrixElement,
|
|
|
|
zoomPlugin,
|
|
|
|
gradient
|
|
|
|
);
|
2023-07-07 19:22:30 +00:00
|
|
|
|
2023-07-23 13:31:28 +00:00
|
|
|
// フォントカラー
|
|
|
|
Chart.defaults.color = getComputedStyle(
|
|
|
|
document.documentElement
|
|
|
|
).getPropertyValue("--fg");
|
2023-07-07 19:22:30 +00:00
|
|
|
|
2023-07-23 13:31:28 +00:00
|
|
|
Chart.defaults.borderColor = defaultStore.state.darkMode
|
|
|
|
? "rgba(255, 255, 255, 0.1)"
|
|
|
|
: "rgba(0, 0, 0, 0.1)";
|
2023-07-07 19:22:30 +00:00
|
|
|
|
2023-07-23 13:31:28 +00:00
|
|
|
Chart.defaults.animation = false;
|
2023-07-07 19:22:30 +00:00
|
|
|
}
|