We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f6f7778 commit 0d35caeCopy full SHA for 0d35cae
2 files changed
.changeset/metal-flowers-sneeze.md
@@ -0,0 +1,5 @@
1
+---
2
+'layerchart': patch
3
4
+
5
+fix(TooltipContext): correct `bisect-band` hit detection by accounting for chart padding
packages/layerchart/src/lib/components/tooltip/TooltipContext.svelte
@@ -310,8 +310,8 @@
310
311
case 'bisect-band': {
312
// `x` and `y` values at pointer coordinate
313
- const xValueAtPoint = scaleInvert(ctx.xScale, point.x);
314
- const yValueAtPoint = scaleInvert(ctx.yScale, point.y);
+ const xValueAtPoint = scaleInvert(ctx.xScale, point.x - ctx.padding.left);
+ const yValueAtPoint = scaleInvert(ctx.yScale, point.y - ctx.padding.top);
315
316
if (isScaleBand(ctx.xScale)) {
317
// Find point closest to pointer within the x band
0 commit comments