[Feature] Mark states: geometry keys (scale, translate, arc angles and radii)

Aperta
#213 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
42/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
d3, typescript

Direzione di ricerca

Read packages/charts-core/src/types.ts and packages/charts-core/src/mark-state.ts, then trace how state transitions apply and tween style values for area and polar marks. Check the polar mark implementation and related state tests to identify the geometry paths involved. Done means the proposed scale and translate keys work for area-kind marks, polar geometry keys are supported, and state transitions tween them.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Version: @tanstack/charts 1.1.0 (57774e1). Split from #186 (comment section E) and #194 (section D) so it can be closed on its own; it also covers what remained of #126 after polar states shipped.

Common hover effects (an arc that grows 3%, a radar polygon at 1.05x, a funnel segment that pops) cannot be written as states; they need a custom spring on renderer-owned DOM.

What exists
  • ChartMarkStateStyle has r (dot), radius and inset (bar, rect) and dx, dy, rotate (text), per the per-mark picks (types.ts:176-260, applied in mark-state.ts:205-235).
  • Marks that render as area nodes (radialArc, sunburst sectors, areaY) have no geometry key at all (ChartAreaStateStyle is paint only), and no mark has a scale or translate key.
  • The group-states doc says the same: "Group states support paint; geometry properties such as dot radius and text rotation apply only to their corresponding leaves" (custom-extensions.md:221-223).
  • Polar marks accept states (polar.ts:229-230, polar.md:52-60), but ChartMarkStateStyle has no startAngle, endAngle, innerRadius or outerRadius.
Ask

Add an optional scale (about the node's own centre or a given origin) and translate to ChartMarkStateStyle for area-kind marks, and for polar arcs innerRadius/outerRadius or startAngle/endAngle, resolved in applyStateStyle and tweened by the state transition.

Example (proposed API; outerRadius is the new key):

radialArc(rows, {
  startAngle: 'start', endAngle: 'end', innerRadius: 60, outerRadius: 80,
  states: [{ when: { focus: 'primary' }, style: { outerRadius: 84 }, transition: { type: 'spring', stiffness: 400, damping: 30 } }],
})

Read from source, not run.

Related: #186 (cost of state changes), #194 (arc motion), #126 (polar states).

Lingua principale
TypeScript
Stelle
870
Fork
57
Merge medio
11h 58m
PR unite (30g)
18

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TanStack/charts

Tutte le issue di TanStack/charts

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.