Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e789a1e
Add xy.tooltip(mode="x"|"y"): a shared-axis tooltip with cursor and a…
Alek99 Sep 2, 2026
2666988
Add news fragment for the shared-axis tooltip (#509)
Alek99 Sep 2, 2026
f34cd6d
Band tooltips: bars join by footprint, survive context loss, keep hov…
Alek99 Sep 2, 2026
9cf6b2f
Fix the band tooltip's hidden-row scan, stale picks, dot size and bar…
sselvakumaran Sep 22, 2026
6d33983
Merge main into the shared-axis tooltip branch
sselvakumaran Sep 22, 2026
ed01bdf
Pin the band tooltip fixes with browser regression tests
sselvakumaran Sep 22, 2026
80b1537
Keep the band inside the plot, out of retired traces, and intact when…
sselvakumaran Sep 22, 2026
4a542b6
Keep the cursor on a clipped bar, honor fields=["x"], drop the band o…
sselvakumaran Sep 22, 2026
872c139
Ask the perpendicular axis the same visibility question
sselvakumaran Oct 1, 2026
32bd953
Measure band visibility per axis, and keep the cursor's footprint in …
sselvakumaran Oct 1, 2026
736b3a1
Decode the animated baseline with the metadata it was written with
sselvakumaran Oct 1, 2026
ba2768a
Merge branch 'main' into alek/tooltip-x-band
FarhanAliRaza Oct 26, 2026
b74198a
Format dates and times in tooltips, in one grammar with the numbers (…
sselvakumaran Nov 4, 2026
ec77158
Merge remote-tracking branch 'origin/main' into alek/tooltip-x-band
sselvakumaran Dec 3, 2026
50c6d65
Fix decimated shared-axis tooltips with canonical coordinate picks
sselvakumaran Dec 3, 2026
3bcc347
Serve sibling module fixtures in HTTP browser probes
sselvakumaran Dec 3, 2026
74e4f08
Stop a timed-out benchmark worker before it makes its group
FarhanAliRaza Dec 3, 2026
8e60833
Default line and area charts to the shared-x tooltip
FarhanAliRaza Dec 3, 2026
90cf590
Let an excluded mark under the pointer win over the band
FarhanAliRaza Dec 3, 2026
2dcb098
Address shared-tooltip review findings and guard coordinate pick comp…
sselvakumaran Dec 3, 2026
0d79b06
Measure copied time fields on their supplier; skip polar default
FarhanAliRaza Dec 3, 2026
5ee1554
Merge concurrent tooltip fixes and retain protocol and regression saf…
sselvakumaran Dec 3, 2026
27f9c4d
Pin benchmark worker identity and restrict mixed-hover geometry scans
sselvakumaran Dec 3, 2026
7a92391
Place worker cleanup deadlines in benchmark methodology
sselvakumaran Dec 3, 2026
94aa414
Match animated bar hover footprints to shader width interpolation
sselvakumaran Dec 3, 2026
f94841c
Refresh animated bar cursor spans and verify pixel boundaries
sselvakumaran Dec 3, 2026
2801244
Clear band hover before releasing WebGL trace resources
sselvakumaran Dec 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions docs/components/tooltips.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,45 @@ See [Events and callbacks](/docs/xy/api-reference/events-and-callbacks/) for
hover payloads and [Marks and components reference](/docs/xy/api-reference/marks-and-components/)
for the exact tooltip signature.

## Shared Tooltip Along an Axis

`xy.tooltip(mode="x")` turns the tooltip into an axis tooltip, the model
Recharts uses by default and Plotly calls `hovermode="x unified"`. The pointer
only has to be inside the plot: its horizontal position snaps to the nearest x
value and every series' point at that x is listed at once, while the vertical
position is ignored. The plot divides into full-height bands with boundaries
halfway between adjacent points, a cursor line marks the selected x, each
series shows an active dot, and the tooltip follows the pointer. Bars join by
their footprint: a grouped bar chart lists every series of the category under
the pointer, with one cursor on the category centre — and no active dots, since
the bar is already the mark. `mode="y"` does the same along
the y axis — useful for horizontal layouts, but available on any Cartesian
chart. The default, `mode="nearest"`, keeps the 12 px nearest-point behavior.

~~~python demo exec
import reflex_xy
import xy

pages = ["Page A", "Page B", "Page C", "Page D", "Page E", "Page F", "Page G"]
shared_tooltip_chart = xy.line_chart(
xy.line(pages, [2400, 1398, 9800, 3908, 4800, 3800, 4300], name="pv", color="#8884d8", width=2),
xy.line(pages, [4000, 3000, 2000, 2780, 1890, 2390, 3490], name="uv", color="#82ca9d", width=2),
xy.tooltip(mode="x"),
xy.legend(loc="upper right"),
title="Hover anywhere above a page",
)


def shared_tooltip_demo():
return reflex_xy.chart(shared_tooltip_chart, height="320px")
~~~

`fields=`, `format=`, and `title=` keep their meaning: the title template
resolves against the first series' row, and each series row shows the
requested fields (minus the band axis, which is already the title). Style the
cursor line through the `tooltip_cursor` slot or the `--chart-crosshair`
token it shares with the crosshair.

## FAQ

### How do I show values on hover in a Python chart?
Expand Down
3 changes: 2 additions & 1 deletion docs/styling/capabilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ and *does the change survive where I need it*. This page answers both from the
registry the implementation is checked against.

- **11** mark style properties across **22** mark kinds, drawn by all three renderers.
- **48** stable chrome slots for CSS and Tailwind in the browser.
- **49** stable chrome slots for CSS and Tailwind in the browser.
- **1** way to add a mark kind XY does not ship, without forking it.

## Mark style properties
Expand Down Expand Up @@ -79,6 +79,7 @@ token bag or in mark and axis `style=`, which every renderer reads.
| `tooltip_row` | full | none | none |
| `tooltip_label` | full | none | none |
| `tooltip_value` | full | none | none |
| `tooltip_cursor` | full | none | none |
| `modebar` | full | none | none |
| `modebar_drag_handle` | full | none | none |
| `modebar_control_group` | full | none | none |
Expand Down
5 changes: 3 additions & 2 deletions docs/styling/chrome-slots.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ primitive or structural descendant is a separate DOM element.
| `tooltip_row` | One tooltip field row |
| `tooltip_label` | One tooltip field label |
| `tooltip_value` | One formatted tooltip value |
| `tooltip_cursor` | Line across the plot at the shared-tooltip band coordinate — vertical for `xy.tooltip(mode="x")`, horizontal for `mode="y"` |
| `modebar` | Mode/tool bar container |
| `modebar_drag_handle` | Draggable grip revealed beside the toolbar |
| `modebar_control_group` | Selection, pan, and export control group |
Expand Down Expand Up @@ -358,8 +359,8 @@ apply it with. Rather than leave that to be discovered, it is a contract:
| --- | --- | --- | --- |
| mark / axis `style=` | yes | yes | yes |
| chart-level `style=` (design tokens) | yes | yes | yes |
| `styles={slot: {...}}` | yes, all 48 slots | text subset, 9 slots | text subset, 9 slots |
| `class_names={slot: "..."}` | yes, all 48 slots | dropped | dropped |
| `styles={slot: {...}}` | yes, all 49 slots | text subset, 9 slots | text subset, 9 slots |
| `class_names={slot: "..."}` | yes, all 49 slots | dropped | dropped |
| `custom_css=` | yes | raises | raises |
| `xy.legend(style=...)` | yes | 6 keys | 6 keys |
| `xy.colorbar(style=...)` | yes | dropped | dropped |
Expand Down
1 change: 1 addition & 0 deletions js/src/20_theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export const XY_CHROME_CSS = `
:where(.xy [data-xy-selection-lasso-handle]){fill:var(--chart-bg,#fff);stroke:var(--chart-selection,var(--xy-selection));stroke-width:1.5;cursor:grab;pointer-events:all}
:where(.xy [data-xy-selection-lasso-handle][data-xy-active]){cursor:grabbing;fill:var(--chart-selection,var(--xy-selection))}
:where(.xy [data-xy-slot="crosshair_x"],.xy [data-xy-slot="crosshair_y"]){background:var(--chart-crosshair,rgba(15,23,42,.42))}
:where(.xy [data-xy-slot="tooltip_cursor"]){background:var(--chart-crosshair,rgba(15,23,42,.42))}
:where(.xy [data-xy-slot="axis_band"]){cursor:var(--xy-axis-band-cursor)}
:where(.xy [data-xy-slot="axis_line"],.xy [data-xy-slot="tick_mark"]){width:var(--xy-axis-rule-width);height:var(--xy-axis-rule-height);background:var(--xy-axis-rule-paint)}
:where(.xy [data-xy-slot="tick_label"]){color:var(--chart-text,inherit)}
Expand Down
Loading
Loading