Skip to content

Add highlighted vertical line to graph (with tooltip sticky to the line)#6293

Merged
apata merged 10 commits intomasterfrom
graph/line-indicator-b
May 5, 2026
Merged

Add highlighted vertical line to graph (with tooltip sticky to the line)#6293
apata merged 10 commits intomasterfrom
graph/line-indicator-b

Conversation

@apata
Copy link
Copy Markdown
Contributor

@apata apata commented Apr 29, 2026

Changes

  • Adds indicator line for selected x-value on graph.
  • Makes tooltip anchor to the right* of the indicator line, aligned by top edge to top of graph.
    • (*) when it fits to the right. Otherwise to the left. If it fits neither right or left, it is clamped to the right edge of the graph.
  • Touch device tooltip change:
    On touch devices, a tap summons the tooltip at tapped x-value (pre-existing logic). When the tooltip has been summoned, dragging on the graph horizontally moves the tooltip (new functionality in this PR). Panning vertically dismisses the tooltip (pre-existing logic). Dragging horizontally without the tooltip being summoned has no effect (pre-existing logic).

There's a pre-existing bug that clicks on menus don't dismiss the tooltip on mobile: this will be addressed separately.

Tests

  • Manually tested on multiple browsers and devices

Changelog

  • Entry has been added to changelog

Documentation

  • This change does not need a documentation update

Dark mode

  • Tested in both dark and light mode

@apata apata added the preview label Apr 29, 2026
@github-actions
Copy link
Copy Markdown

Preview environment👷🏼‍♀️🏗️
PR-6293

@apata apata marked this pull request as ready for review April 30, 2026 07:52
@apata apata requested a review from a team April 30, 2026 09:07
Copy link
Copy Markdown
Contributor

@ukutaht ukutaht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

Copy link
Copy Markdown
Contributor

@RobertJoonas RobertJoonas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UX feels amazing and looks good code-wise too. Nice work! 🙌

Comment on lines +278 to +283
setTooltip({
selectedIndex: closestPoint.index,
x: closestPoint.x,
y: 0,
persistent: true
})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick (non-blocking): Looks like the y position of the tooltip is always a fixed 0 (and I think that makes perfect sense with the vertical line!) Did you consider removing the y value from the state?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks and well spotted! I did consider it, but then decided to keep the (x, y) positioning API. With just x, it's slightly less self-explanatory. However, now that you pointed it out, I can see how it may be confusing and a source of bugs. Suggestion applied! c8d8fb0

@apata apata added this pull request to the merge queue May 4, 2026
@apata apata removed this pull request from the merge queue due to a manual request May 4, 2026
@apata apata added this pull request to the merge queue May 5, 2026
Merged via the queue into master with commit a2c8765 May 5, 2026
38 of 40 checks passed
@apata apata deleted the graph/line-indicator-b branch May 5, 2026 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants