[Feature] Expose the focus position to the host: CSS variables on the root, plot-space pointer in `onFocusChange`
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- d3, typescript
- Ambito
- data-visualization, frontend
Direzione di ricerca
Start with packages/charts-core/src/renderer.ts, especially notifyFocus and sameFocusObservation, which the issue identifies as the focus notification and deduplication points. Trace how the renderer resolves pointer positions and how tooltip positions are represented before deciding where to expose them. Done means an opt-in can expose focus index and plot coordinates on the chart root, clear them when focus ends, and report pointer position through the focus callback or a new pointer callback.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Version: @tanstack/charts 1.1.0 (57774e1).
Today the focused point is only available through onFocusChange. Styling something from focus, such as fading axis ticks near the hovered x or dimming the other bars, means writing the value yourself on every focus change from that callback.
We do exactly this in a chart migration: the host sets --hover-x and its siblings on the chart root, and CSS reads them. It works, but each chart has to wire the same callback-to-style plumbing, and the write happens on a separate path from the library's own focus paint.
Ask: an opt-in to have the renderer set the focused datum's index and position on the chart root, for example data-focus-index and --ts-focus-x/--ts-focus-y in plot coordinates, and clear them when focus ends. That would let charts style focus from CSS alone, without a scene rebuild or extra JS per move.
Checked against 57774e14a1a86081eddb3a23523724a40da05640 (v1.1.0).
The pointer position is never reported (moved here from #190's comment)
notifyFocus calls onFocusChange only when the primary point's (key, markId, datumIndex) or Object.is(datum) changes (renderer.ts:561-581, sameFocusObservation at renderer.ts:1404-1416). Moves inside one point's hit region produce no callback, and the callback carries no coordinates.
Example: a live line chart whose crosshair and pill follow the raw pointer x between samples cannot get that x from the focus pipeline. It needs a separate pointermove listener on the container, and it then has to convert client coordinates to plot space itself.
Proposal: pass the resolved pointer position (plot-space x/y, or the ChartTooltipPosition already used for tooltips) as a second argument to onFocusChange, or add an opt-in onPointerMove with scene coordinates. This does not conflict with the dedupe in #178; it only adds data to the call that already happens. The CSS variables above would be filled from the same position.
- Lingua principale
- TypeScript
- Stelle
- 870
- Fork
- 57
- Merge medio
- 11h 58m
- PR unite (30g)
- 18
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di TanStack/charts
-
[Perf] Canvas layer composition is quadratic: splitRenderLayers re-copies the node array per nodeAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug] Focus guides: `url(#id)` paints ignore `idPrefix`Forse già presa @getdownandcode l’ha presa 37 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
TanStack/charts#211 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Add reverse options to waffleY and waffleXForse già presa @tannerlinsley l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di TanStack/charts
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
fb55/htmlparser2#2579 ·
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue needs-review
Difficoltà 1/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno
-
Add Module DB RulesApertadocumentation public
Difficoltà 1/5 1-3 ore Idoneità per principianti 68/100
midnightntwrk/umbradb#65 ·
I maintainer di solito rispondono entro 2 giorni
-
area/channels kind/bug priority/medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
nanocoai/nanoclaw#4501 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
needs verification
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 13 giorni