summaryrefslogtreecommitdiff
path: root/packages/client/src/scripts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2022-12-23 15:21:55 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2022-12-23 15:21:55 +0900
commit052e667f0357a059dd17f46ccce68d2598146724 (patch)
tree75226d51850fef5630446478b6fe70bafba67818 /packages/client/src/scripts
parent13.0.0-alpha.6 (diff)
downloadsharkey-052e667f0357a059dd17f46ccce68d2598146724.tar.gz
sharkey-052e667f0357a059dd17f46ccce68d2598146724.tar.bz2
sharkey-052e667f0357a059dd17f46ccce68d2598146724.zip
enhance(client): enhance dashboard of control panel
Diffstat (limited to 'packages/client/src/scripts')
-rw-r--r--packages/client/src/scripts/chart-vline.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/packages/client/src/scripts/chart-vline.ts b/packages/client/src/scripts/chart-vline.ts
new file mode 100644
index 0000000000..8e3c4436b2
--- /dev/null
+++ b/packages/client/src/scripts/chart-vline.ts
@@ -0,0 +1,21 @@
+export const chartVLine = (vLineColor: string) => ({
+ id: 'vLine',
+ beforeDraw(chart, args, options) {
+ if (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();
+ }
+ },
+});