summaryrefslogtreecommitdiff
path: root/packages/client/src/components/chart.vue
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2022-01-28 11:19:18 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2022-01-28 11:19:18 +0900
commit6ebab5f57737842b609688c89a0063f10d247b9a (patch)
tree13ea9824548bfbf36de9d5643875d2fc7f989c2e /packages/client/src/components/chart.vue
parentfix(client): トレンドウィジェットが動作しないのを修正 (diff)
downloadmisskey-6ebab5f57737842b609688c89a0063f10d247b9a.tar.gz
misskey-6ebab5f57737842b609688c89a0063f10d247b9a.tar.bz2
misskey-6ebab5f57737842b609688c89a0063f10d247b9a.zip
chore(client): improve chart rendering
Diffstat (limited to 'packages/client/src/components/chart.vue')
-rw-r--r--packages/client/src/components/chart.vue22
1 files changed, 22 insertions, 0 deletions
diff --git a/packages/client/src/components/chart.vue b/packages/client/src/components/chart.vue
index 1959271f5d..d17c0c9f3e 100644
--- a/packages/client/src/components/chart.vue
+++ b/packages/client/src/components/chart.vue
@@ -143,6 +143,7 @@ export default defineComponent({
}
const gridColor = defaultStore.state.darkMode ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.1)';
+ const vLineColor = defaultStore.state.darkMode ? 'rgba(255, 255, 255, 0.2)' : 'rgba(0, 0, 0, 0.2)';
// フォントカラー
Chart.defaults.color = getComputedStyle(document.documentElement).getPropertyValue('--fg');
@@ -255,6 +256,27 @@ export default defineComponent({
},
},
},
+ plugins: [{
+ id: 'vLine',
+ beforeDraw(chart, args, options) {
+ if (chart.tooltip._active && chart.tooltip._active.length) {
+ const activePoint = chart.tooltip._active[0];
+ const ctx = chart.ctx;
+ const x = activePoint.element.x;
+ const topY = chart.scales.y.top;
+ const bottomY = chart.scales.y.bottom;
+
+ ctx.save();
+ ctx.beginPath();
+ ctx.moveTo(x, bottomY);
+ ctx.lineTo(x, topY);
+ ctx.lineWidth = 1;
+ ctx.strokeStyle = vLineColor;
+ ctx.stroke();
+ ctx.restore();
+ }
+ }
+ }]
});
};