2022-07-23 23:00:59 +02:00
|
|
|
<template>
|
|
|
|
<canvas ref="chartEl"></canvas>
|
|
|
|
</template>
|
|
|
|
|
2022-07-23 23:03:20 +02:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { onMounted, onUnmounted, ref } from 'vue';
|
2022-07-23 23:00:59 +02:00
|
|
|
import {
|
|
|
|
Chart,
|
|
|
|
ArcElement,
|
|
|
|
LineElement,
|
|
|
|
BarElement,
|
|
|
|
PointElement,
|
|
|
|
BarController,
|
|
|
|
LineController,
|
|
|
|
CategoryScale,
|
|
|
|
LinearScale,
|
|
|
|
TimeScale,
|
|
|
|
Legend,
|
|
|
|
Title,
|
|
|
|
Tooltip,
|
|
|
|
SubTitle,
|
|
|
|
Filler,
|
|
|
|
} from 'chart.js';
|
|
|
|
import number from '@/filters/number';
|
|
|
|
import * as os from '@/os';
|
|
|
|
import { defaultStore } from '@/store';
|
|
|
|
|
|
|
|
Chart.register(
|
|
|
|
ArcElement,
|
|
|
|
LineElement,
|
|
|
|
BarElement,
|
|
|
|
PointElement,
|
|
|
|
BarController,
|
|
|
|
LineController,
|
|
|
|
CategoryScale,
|
|
|
|
LinearScale,
|
|
|
|
TimeScale,
|
|
|
|
Legend,
|
|
|
|
Title,
|
|
|
|
Tooltip,
|
|
|
|
SubTitle,
|
|
|
|
Filler,
|
|
|
|
);
|
|
|
|
|
2022-07-23 23:03:20 +02:00
|
|
|
const props = defineProps<{
|
|
|
|
domain: string,
|
|
|
|
connection: any,
|
|
|
|
}>();
|
2022-07-23 23:00:59 +02:00
|
|
|
|
2022-07-23 23:03:20 +02:00
|
|
|
const chartEl = ref<HTMLCanvasElement>(null);
|
2022-07-23 23:00:59 +02:00
|
|
|
|
2022-07-23 23:03:20 +02:00
|
|
|
const gridColor = defaultStore.state.darkMode ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.1)';
|
2022-07-23 23:00:59 +02:00
|
|
|
|
2022-07-23 23:03:20 +02:00
|
|
|
// フォントカラー
|
|
|
|
Chart.defaults.color = getComputedStyle(document.documentElement).getPropertyValue('--fg');
|
2022-07-23 23:00:59 +02:00
|
|
|
|
2022-07-23 23:03:20 +02:00
|
|
|
onMounted(() => {
|
|
|
|
const chartInstance = new Chart(chartEl.value, {
|
|
|
|
type: 'line',
|
|
|
|
data: {
|
|
|
|
labels: [],
|
|
|
|
datasets: [{
|
|
|
|
label: 'Process',
|
|
|
|
pointRadius: 0,
|
|
|
|
tension: 0,
|
|
|
|
borderWidth: 2,
|
|
|
|
borderJoinStyle: 'round',
|
|
|
|
borderColor: '#9ccfd8',
|
|
|
|
backgroundColor: '#9ccfd81A',
|
|
|
|
data: []
|
|
|
|
}, {
|
|
|
|
label: 'Active',
|
|
|
|
pointRadius: 0,
|
|
|
|
tension: 0,
|
|
|
|
borderWidth: 2,
|
|
|
|
borderJoinStyle: 'round',
|
|
|
|
borderColor: '#31748f',
|
|
|
|
backgroundColor: '#31748f1A',
|
|
|
|
data: []
|
|
|
|
}, {
|
|
|
|
label: 'Waiting',
|
|
|
|
pointRadius: 0,
|
|
|
|
tension: 0,
|
|
|
|
borderWidth: 2,
|
|
|
|
borderJoinStyle: 'round',
|
|
|
|
borderColor: '#f6c177',
|
|
|
|
backgroundColor: '#f6c1771A',
|
|
|
|
yAxisID: 'y2',
|
|
|
|
data: []
|
|
|
|
}, {
|
|
|
|
label: 'Delayed',
|
|
|
|
pointRadius: 0,
|
|
|
|
tension: 0,
|
|
|
|
borderWidth: 2,
|
|
|
|
borderJoinStyle: 'round',
|
|
|
|
borderColor: '#eb6f92',
|
|
|
|
borderDash: [5, 5],
|
|
|
|
fill: false,
|
|
|
|
yAxisID: 'y2',
|
|
|
|
data: []
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
options: {
|
|
|
|
aspectRatio: 2.5,
|
|
|
|
layout: {
|
|
|
|
padding: {
|
|
|
|
left: 16,
|
|
|
|
right: 16,
|
|
|
|
top: 16,
|
|
|
|
bottom: 8,
|
2022-07-23 23:00:59 +02:00
|
|
|
},
|
2022-07-23 23:03:20 +02:00
|
|
|
},
|
|
|
|
scales: {
|
|
|
|
x: {
|
|
|
|
grid: {
|
|
|
|
display: true,
|
|
|
|
color: gridColor,
|
|
|
|
borderColor: '#1f1d2e',
|
2022-07-23 23:00:59 +02:00
|
|
|
},
|
2022-07-23 23:03:20 +02:00
|
|
|
ticks: {
|
|
|
|
display: false,
|
|
|
|
maxTicksLimit: 10
|
2022-07-23 23:00:59 +02:00
|
|
|
},
|
|
|
|
},
|
2022-07-23 23:03:20 +02:00
|
|
|
y: {
|
|
|
|
min: 0,
|
|
|
|
stack: 'queue',
|
|
|
|
stackWeight: 2,
|
|
|
|
grid: {
|