2023-01-02 03:18:47 +02:00
|
|
|
import {
|
|
|
|
Chart,
|
|
|
|
ArcElement,
|
|
|
|
LineElement,
|
|
|
|
BarElement,
|
|
|
|
PointElement,
|
|
|
|
BarController,
|
|
|
|
LineController,
|
|
|
|
DoughnutController,
|
|
|
|
CategoryScale,
|
|
|
|
LinearScale,
|
|
|
|
TimeScale,
|
|
|
|
Legend,
|
|
|
|
Title,
|
|
|
|
Tooltip,
|
|
|
|
SubTitle,
|
|
|
|
Filler,
|
|
|
|
} from 'chart.js';
|
|
|
|
import gradient from 'chartjs-plugin-gradient';
|
|
|
|
import zoomPlugin from 'chartjs-plugin-zoom';
|
|
|
|
import { MatrixController, MatrixElement } from 'chartjs-chart-matrix';
|
2023-01-02 12:58:51 +02:00
|
|
|
import { defaultStore } from '@/store';
|
2023-01-03 06:09:24 +02:00
|
|
|
import 'chartjs-adapter-date-fns';
|
2023-01-02 03:18:47 +02:00
|
|
|
|
|
|
|
export function initChart() {
|
|
|
|
Chart.register(
|
|
|
|
ArcElement,
|
|
|
|
LineElement,
|
|
|
|
BarElement,
|
|
|
|
PointElement,
|
|
|
|
BarController,
|
|
|
|
LineController,
|
|
|
|
DoughnutController,
|
|
|
|
CategoryScale,
|
|
|
|
LinearScale,
|
|
|
|
TimeScale,
|
|
|
|
Legend,
|
|
|
|
Title,
|
|
|
|
Tooltip,
|
|
|
|
SubTitle,
|
|
|
|
Filler,
|
|
|
|
MatrixController, MatrixElement,
|
|
|
|
zoomPlugin,
|
|
|
|
gradient,
|
|
|
|
);
|
2023-01-02 12:58:51 +02:00
|
|
|
|
|
|
|
// フォントカラー
|
|
|
|
Chart.defaults.color = getComputedStyle(document.documentElement).getPropertyValue('--fg');
|
|
|
|
|
|
|
|
Chart.defaults.borderColor = defaultStore.state.darkMode ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.1)';
|
|
|
|
|
|
|
|
Chart.defaults.animation = false;
|
2023-01-02 03:18:47 +02:00
|
|
|
}
|