From fdd7e022e96e3689280f0b603d0674aaa17c6dc2 Mon Sep 17 00:00:00 2001 From: Vikrant Gupta Date: Mon, 4 Mar 2024 18:47:38 +0530 Subject: [PATCH] fix: offset added hinders the timestamps for the traces (#4642) * fix: offset added hinders the timestamps for the traces * fix: offset added hinders the timestamps for the traces --- frontend/src/lib/uPlotLib/plugins/onClickPlugin.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/lib/uPlotLib/plugins/onClickPlugin.ts b/frontend/src/lib/uPlotLib/plugins/onClickPlugin.ts index 56a6f1e333..7dfbbe9b47 100644 --- a/frontend/src/lib/uPlotLib/plugins/onClickPlugin.ts +++ b/frontend/src/lib/uPlotLib/plugins/onClickPlugin.ts @@ -18,8 +18,9 @@ function onClickPlugin(opts: OnClickPluginOpts): uPlot.Plugin { const mouseY = event.offsetY + 40; // Convert pixel positions to data values - const xValue = u.posToVal(mouseX, 'x'); - const yValue = u.posToVal(mouseY, 'y'); + // do not use mouseX and mouseY here as it offsets the timestamp as well + const xValue = u.posToVal(event.offsetX, 'x'); + const yValue = u.posToVal(event.offsetY, 'y'); opts.onClick(xValue, yValue, mouseX, mouseY); };