From 4e4c559db6964cbf17fcadf38d55fc79c995ca42 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 22 Oct 2021 05:36:48 +0900 Subject: Migrate to Chart.js v3 (#7896) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * wip * wip * wip * wip * wip * wip * wip * 定期的にresync * Update overview.vue * wip * wip --- src/client/components/chart.vue | 628 ++++++++++++++++++++++++++++++ src/client/components/instance-stats.vue | 487 +---------------------- src/client/components/number-diff.vue | 47 +++ src/client/pages/instance-info.vue | 266 +------------ src/client/pages/instance/instance.vue | 266 +------------ src/client/pages/instance/metrics.vue | 83 ++-- src/client/pages/instance/overview.vue | 176 ++++++--- src/client/pages/instance/queue.chart.vue | 2 +- src/client/scripts/hpml/lib.ts | 7 +- 9 files changed, 892 insertions(+), 1070 deletions(-) create mode 100644 src/client/components/chart.vue create mode 100644 src/client/components/number-diff.vue (limited to 'src/client') diff --git a/src/client/components/chart.vue b/src/client/components/chart.vue new file mode 100644 index 0000000000..3599266cb6 --- /dev/null +++ b/src/client/components/chart.vue @@ -0,0 +1,628 @@ + + + diff --git a/src/client/components/instance-stats.vue b/src/client/components/instance-stats.vue index 5e7c71ea65..fd0b75609f 100644 --- a/src/client/components/instance-stats.vue +++ b/src/client/components/instance-stats.vue @@ -24,35 +24,26 @@ - + - + diff --git a/src/client/components/number-diff.vue b/src/client/components/number-diff.vue new file mode 100644 index 0000000000..ba7e6964de --- /dev/null +++ b/src/client/components/number-diff.vue @@ -0,0 +1,47 @@ + + + + + diff --git a/src/client/pages/instance-info.vue b/src/client/pages/instance-info.vue index 4fbf104f0c..7a4cd5f016 100644 --- a/src/client/pages/instance-info.vue +++ b/src/client/pages/instance-info.vue @@ -65,17 +65,17 @@
- - - - - - - - - - - + + + + + + + + + + + @@ -83,7 +83,7 @@
- +
@@ -135,7 +135,7 @@ + + diff --git a/src/client/pages/instance/queue.chart.vue b/src/client/pages/instance/queue.chart.vue index 887fe9a574..4f8fd762bb 100644 --- a/src/client/pages/instance/queue.chart.vue +++ b/src/client/pages/instance/queue.chart.vue @@ -67,7 +67,7 @@ export default defineComponent({ // TODO: var(--panel)の色が暗いか明るいかで判定する const gridColor = this.$store.state.darkMode ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.1)'; - Chart.defaults.global.defaultFontColor = getComputedStyle(document.documentElement).getPropertyValue('--fg'); + Chart.defaults.color = getComputedStyle(document.documentElement).getPropertyValue('--fg'); this.chart = markRaw(new Chart(this.$refs.chart, { type: 'line', diff --git a/src/client/scripts/hpml/lib.ts b/src/client/scripts/hpml/lib.ts index 150a04732f..200faf820b 100644 --- a/src/client/scripts/hpml/lib.ts +++ b/src/client/scripts/hpml/lib.ts @@ -1,11 +1,11 @@ import * as tinycolor from 'tinycolor2'; -import Chart from 'chart.js'; import { Hpml } from './evaluator'; import { values, utils } from '@syuilo/aiscript'; import { Fn, HpmlScope } from '.'; import { Expr } from './expr'; import * as seedrandom from 'seedrandom'; +/* // https://stackoverflow.com/questions/38493564/chart-area-background-color-chartjs Chart.pluginService.register({ beforeDraw: (chart, easing) => { @@ -18,6 +18,7 @@ Chart.pluginService.register({ } } }); +*/ export function initAiLib(hpml: Hpml) { return { @@ -49,11 +50,12 @@ export function initAiLib(hpml: Hpml) { ])); }), 'MkPages:chart': values.FN_NATIVE(([id, opts]) => { + /* TODO utils.assertString(id); utils.assertObject(opts); const canvas = hpml.canvases[id.value]; const color = getComputedStyle(document.documentElement).getPropertyValue('--accent'); - Chart.defaults.global.defaultFontColor = '#555'; + Chart.defaults.color = '#555'; const chart = new Chart(canvas, { type: opts.value.get('type').value, data: { @@ -122,6 +124,7 @@ export function initAiLib(hpml: Hpml) { }) } }); + */ }) }; } -- cgit v1.2.3-freya