Linked interactivity
@sportsdataverse/sdvplot/interact links views through one selection store: what is hovered, what is selected, a brushed region, and a shared cursor value. A chart or a table that is linked to the store both writes to it and follows it, so linking a new view is one call. This page links a brushable Plot scatter to a hydrated sdvtables table, two charts to one cursor, two charts through the nearest mark, and a strip of games used as checkboxes.
A brushed scatter and a table on one store
Every NFL team's 2024 EPA per play, offence against defence, drawn as logos. Drag a rectangle on the chart to brush it: the teams inside become the store's selection, the rest dim, and the table keeps only the brushed teams, selected. Hover a logo to underline its table row; hover a row to light its logo; click rows to select them. Empty brush decides what a brush that holds no team means: dim keeps the empty region (everything dims, the table shows no row), clear drops it. The buttons move the brush from code with the handle's move(), in data coordinates.
The store now holds:
One cursor across two charts
The Chiefs' and the Eagles' 2024 regular seasons, week by week: each bar is a game's margin. linkCursor draws the store's cursor (one shared value, here a week) through each chart's own scale, and writes the week under the pointer. Point at a week in either chart: both mark it, and each says who that team played. The teams had different bye weeks (Philadelphia in week 5, Kansas City in week 6), so in a bye week one chart has nothing to say.
The nearest mark, and a tooltip anywhere
Brooklyn's first 2000 shots of 2025-26 on a half court, and the share of them from each foot. Both charts are keyed by shot distance, so hovering one shot lights every shot from that distance and its bar. nearestHover hovers the nearest mark rather than the one exactly under the pointer: on the court, the closest shot within 18 px (a Delaunay search); on the bars, the foot under the pointer's x, however far below the bar's top it is. The court's box comes from nearestHover's label; the bars' box is tooltip(), driven by the store, so it shows whichever chart wrote the hover.
Marks as checkboxes
linkSelection(store, { figure, select: "toggle" }) turns every stamped mark into a checkbox: click a game, or Tab to it and press Enter or Space, to add it to the store's selection or take it out. Each cell is one of Brooklyn's 24 games, green for a win; the court below draws only the checked games' shots (all of them when none is checked), in 1.5 ft hexagons against the league.