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
This commit is contained in:
Vikrant Gupta 2024-03-04 18:47:38 +05:30 committed by GitHub
parent 90d7f0200a
commit fdd7e022e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);
};