observablehq / observablehq/plot

PointerY falls back to nearest X/Y outside of frame

Open
#2,439 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
HTML
Stars
5.4k
Forks
244
PR merge metrics
No merged PRs in 30d

Description

When the cursor is moved outside of the frame area, PointerY will no longer match by closest Y, instead matching the closest point b X/Y distance.

This is problematic when hovering axis labels, as the tooltip may no longer line up with the axis label.

Example:

Plot.plot({
  height: 100,
  marks: [
    Plot.frame(),
    Plot.dot([1,2,1], {x: d => d, y: (d, i) => i, tip: {pointer: "y"}}),
  ],
})

https://github.com/user-attachments/assets/7c3c0395-c65c-4316-8be7-36763bae4af6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the supplied Plot.plot example and inspect the PointerY interaction behavior when the cursor is outside the frame, especially over axis labels. The change is done when PointerY consistently matches the closest Y and the tooltip remains aligned with the hovered axis label; the issue names no file or test to start from.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data-visualization, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.