Skip to content

Synchronised cross-pane tooltips and value-coloured line subplot#255

Closed
maread99 wants to merge 2 commits into
mainfrom
claude/determined-shannon-4pv66p
Closed

Synchronised cross-pane tooltips and value-coloured line subplot#255
maread99 wants to merge 2 commits into
mainfrom
claude/determined-shannon-4pv66p

Conversation

@maread99

@maread99 maread99 commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Summary

Adds two general charting capabilities.

1. Synchronised tooltips across the price chart and its subplots

When the price chart or any subplot is hovered, every other pane shows its own value for the hovered bar; all the synced tooltips are hidden together when the cursor leaves the hovered pane.

  • charts.SyncedTooltip — a mixin giving a pane a lightweight "value at bar" tooltip (a bq.Label), shown/hidden via show_synced_tooltip(x) / hide_synced_tooltip(). Mixed into BasePrice (price charts, value = close) and BaseSubplot (subplots, value = the subplot's value). Hosts customise via _synced_tooltip_series, _format_synced_value, _synced_tooltip_prefix and _event_x.
  • guis.BasePrice coordinates the panes (_init_synced_tooltips): it wires each pane's mark hover to show the other panes' tooltips (the hovered pane keeps showing its own native tooltip), and uses ipyevents mouseleave on each figure to clear them — bqplot marks emit no un-hover event, so a DOM-level signal is needed. No effect when there are no subplots.
  • guis.GuiOHLCCaseBase additionally wires the case scatter marks, so hovering a case (e.g. a position's entry/exit point) shows the subplots' tooltips for that bar.

2. charts.SubplotLineColored

Base class for a line subplot coloured by value: the line graduates from the first to the last colour of COLOR_SCALE (default blue→red) as the value rises from its lowest to its highest over all the data. Because a bq.Lines mark colours each line as a whole, the line is split into one bqplot line per pair of adjacent bars, each coloured via a bq.ColorScale fixed to the full value range (so a given value always maps to the same colour). The redundant colourbar (colour axis) is suppressed.

Dependencies

Adds ipyevents (lockfile updated).

Testing

  • New tests in tests/test_charts.py (SubplotLineColored, SyncedTooltip) and tests/test_guis.py (TestSyncedTooltips, including hover-dispatch integration).
  • Full suite: 137 passed. ruff check/format clean; no new mypy findings.

Note: the per-pane rendering of the synced tooltips and the mouseleave-driven hide are frontend (JupyterLab) behaviours that can't be exercised headlessly; the tests cover the Python-side logic (bar mapping, content/series, show/hide state, and coordinator dispatch). Worth a quick visual check in JupyterLab.

🤖 Generated with Claude Code


Generated by Claude Code

claude added 2 commits June 22, 2026 13:54
Add tooltips synchronised across a price chart and its subplots: when any
pane is hovered, every other pane shows its own value for the hovered bar,
and all are hidden when the cursor leaves the hovered pane.

- `charts.SyncedTooltip` mixin: a per-pane `bq.Label` "value at bar"
  tooltip, shown/hidden via `show_synced_tooltip`/`hide_synced_tooltip`.
  Mixed into `BasePrice` (price charts) and `BaseSubplot` (subplots).
- `guis.BasePrice` coordinates the panes: it wires each pane's mark hover
  to show the others' tooltips, and uses `ipyevents` mouseleave on each
  figure to hide them (bqplot emits no un-hover event). `GuiOHLCCaseBase`
  also wires the case scatter marks, so hovering a case (e.g. a position
  entry/exit) shows the subplots' tooltips for that bar.
- `charts.SubplotLineColored`: base for a line subplot coloured by value
  (segments coloured via a `bq.ColorScale` fixed to the full value range;
  colour axis suppressed). Generalised from downstream use.

Adds `ipyevents` dependency.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015xReNp6C4sSNy6Nc7K1hzM
Skip the value-coloured line's native tooltip where the hovered bar has
no value (nan). Add a unit test for `GuiOHLCCaseBase._scatter_event_x`,
which maps a case scatter's hover to the corresponding bar.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015xReNp6C4sSNy6Nc7K1hzM

Copy link
Copy Markdown
Owner Author

Closing in favour of the bqplot-only (no new dependency) implementation in #256, which has been merged to main. This ipyevents-based variant is retained on its branch for reference only.


Generated by Claude Code

@maread99 maread99 closed this Jun 26, 2026
@maread99 maread99 deleted the claude/determined-shannon-4pv66p branch June 26, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants