Synchronised cross-pane tooltips and value-coloured line subplot#255
Closed
maread99 wants to merge 2 commits into
Closed
Synchronised cross-pane tooltips and value-coloured line subplot#255maread99 wants to merge 2 commits into
maread99 wants to merge 2 commits into
Conversation
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
Owner
Author
|
Closing in favour of the bqplot-only (no new dependency) implementation in #256, which has been merged to Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 (abq.Label), shown/hidden viashow_synced_tooltip(x)/hide_synced_tooltip(). Mixed intoBasePrice(price charts, value = close) andBaseSubplot(subplots, value = the subplot's value). Hosts customise via_synced_tooltip_series,_format_synced_value,_synced_tooltip_prefixand_event_x.guis.BasePricecoordinates 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 usesipyeventsmouseleaveon 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.GuiOHLCCaseBaseadditionally 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.SubplotLineColoredBase 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 abq.Linesmark colours each line as a whole, the line is split into one bqplot line per pair of adjacent bars, each coloured via abq.ColorScalefixed 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
tests/test_charts.py(SubplotLineColored,SyncedTooltip) andtests/test_guis.py(TestSyncedTooltips, including hover-dispatch integration).ruff check/formatclean; no newmypyfindings.🤖 Generated with Claude Code
Generated by Claude Code