[Feature] `text` mark: numeric tween with a `format` function
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 57/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- d3, typescript
- Área
- data-visualization, frontend
Línea de trabajo
Read packages/charts-core/src/text.ts around lines 112–114 and packages/charts-core/src/motion.ts around lines 2113–2116, then run the provided Vitest repro. Trace how text marks are rendered and how the reconciler handles text leaves; define completion by intermediate formatted values appearing during the tween, the final text matching the target exactly, and reduced motion retaining the snap behavior.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Version: @tanstack/charts 1.1.0 (57774e1). Split from #193 (section B) so it can be closed on its own.
A text mark showing a number (a total in a donut centre, a value label) jumps to the new string while the marks around it animate.
Why
textconverts the datum withString(datum)(text.ts:112-114); there is no numeric or format option.- The reconciler writes leaf text immediately (
motion.ts:2113-2116).
Repro
Save as packages/charts-core/src/repro.test.ts, run pnpm vitest run packages/charts-core/src/repro.test.ts (vitest + jsdom, rAF driven by hand).
import { expect, it, vi } from 'vitest'
import { scaleLinear } from 'd3-scale'
import { defineChart, text } from './index'
import { motion } from './motion'
import { createChartScene } from './scene'
it('numeric text content tweens', () => {
const queue: FrameRequestCallback[] = []
const tick = (t: number) => queue.splice(0).forEach((f) => f(t))
vi.spyOn(window, 'requestAnimationFrame').mockImplementation((f) => queue.push(f))
vi.spyOn(window, 'cancelAnimationFrame').mockImplementation(() => {})
const el = document.createElement('div')
const s = motion({ transition: { type: 'tween', duration: 1000, easing: 'linear' } }).mount(el, () => {})
const scales = { x: { scale: scaleLinear }, y: { scale: scaleLinear } }
const render = (v: number) => s.render(createChartScene(defineChart({ scales, guides: false,
marks: [text([v], { x: () => 0.5, y: () => 0.5, text: (d) => d.toFixed(0) })] }), { width: 300, height: 200 }), { ariaLabel: 'x' })
render(10); tick(0); tick(2000)
render(90); tick(0)
const seen = new Set<string>()
for (const t of [250, 500, 750]) { tick(t); seen.add(el.querySelector('text')!.textContent!) }
expect([...seen].length).toBeGreaterThan(1)
})
Output on 57774e1: distinct textContent values at 250/500/750 ms = [ '90' ] (expected more than 1).
Ask
An opt-in numeric text tween that writes the formatted string each frame and ends on the exact target; reduced motion keeps the snap. For example a format?: (value: number) => string option on text plus a motion opt-in.
Related: #193.
- Lenguaje dominante
- TypeScript
- Estrellas
- 819
- Forks
- 49
- Merge medio
- 12 h 9 min
- PR fusionados (30 d)
- 6
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de TanStack/charts
-
[Bug] Focus guides: `url(#id)` paints ignore `idPrefix`Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Renderer treats a sub-pixel width difference as a resize, which cancels the `motion()` entranceAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
TanStack/charts#182 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
brushX with `values` can shorten the selection range when it’s dragged to the plot edgePosiblemente ocupada @andersk la tomó hace 7 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 42/100
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
Todos los issues de TanStack/charts
Issues similares
-
e2e-failure ready-to-code
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
redhat-developer/rhdh-plugin-export-overlays#4391 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
Luligu/matterbridge#655 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
software-mansion/argent#1457 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
schmayterling/hibi#245 ·
Los mantenedores suelen responder en 1 día
-
After a failed save, the red error banner stays on every page until the app is reloadedPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoai-driven-qa bug claude Minor
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
linagora/twake-contacts-frontend#241 ·
Los mantenedores suelen responder en 1 día