[Bug] Printed charts keep their screen width: resize redraw waits for an animation frame
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- d3, react, typescript
- Área
- data-visualization, frontend
Línea de trabajo
Start in packages/charts-core/src/renderer.ts around lines 406-432, where scheduleRender() defers redraws to requestAnimationFrame, and trace how the ResizeObserver callback reaches it. The root svg uses a viewBox built from the screen width, so the redraw must run when the container width changes, including under print media. Pull request #229 is already open against this issue, so check it before starting.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Version: @tanstack/charts 1.1.0, Chromium. Also seen with Playwright page.pdf().
A responsive chart (no width) is drawn at its screen width. When the page is printed or exported with page.pdf(), the print layout narrows the container but the chart is not redrawn. The browser scales the screen drawing down, so text and strokes shrink, and a fixed-height chart is letterboxed with empty space above and below.
Why
- The root SVG uses
width="100%" height="100%"withviewBox="0 0 <screenWidth> <height>", so a width change scales the existing drawing. ResizeObserversees the new size, but the redraw goes throughscheduleRender(), which waits forrequestAnimationFrame(renderer.ts).- Print and
page.pdf()lay out and paint without running an animation frame, so the redraw never happens before the page is printed.
Repro
- Render
<Chart definition={…} height={320} ariaLabel="…" />in a container with a percentage width. - Open print preview in a viewport wider than the page, or call
page.pdf({ format: 'A4' })on a 1200px-wide page. - The chart is a scaled-down screen drawing, not a chart laid out for the page width.
Expected
The chart redraws at the print container width before printing.
Workaround
On the print media change, measure the container and pass it as a fixed width inside flushSync, then remove width when print ends. It works, but every app that prints has to know about it.
- Lenguaje dominante
- TypeScript
- Estrellas
- 842
- Forks
- 53
- Merge medio
- 4 h 40 min
- PR fusionados (30 d)
- 16
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 @getdownandcode la tomó hace 4 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
TanStack/charts#211 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Feature] Readable outside labels for crowded pie and donut chartsPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
TanStack/charts#227 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 42/100
TanStack/charts#216 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 57/100
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
TanStack/charts#214 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de TanStack/charts
Issues similares
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
lingdojo/kana-dojo#32663 · 1 comentario · 5 reacciones ·
Los mantenedores suelen responder en 1 día
-
Admin: Title Separator field can't be cleared (input falls back to "|")Posiblemente ocupada @emdashbot la tomó hoy. Abiertobot:bug bot:in-review
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
emdash-cms/emdash#4236 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
PHP workflow streaming requests buffer the full SSE responsePosiblemente ocupada @Winoren la tomó hoy. Abiertoreview: medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
langgenius/dify#44270 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
area:holodeck review-finding
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
hyperdrive-technology/holodeck#142 ·
Los mantenedores suelen responder en 1 día
-
session-worker-compile.yml uses a floating oven-sh/setup-bun@v2 tag instead of the pinned SHAAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
code-yeongyu/senpi#3573 ·
Los mantenedores suelen responder en 1 día