Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Bug] Printed charts keep their screen width: resize redraw waits for an animation frame

Open
#228 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@piecyk is already working on this.

Since Oct 14, 2026.

  • #229 by @piecyk — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
d3, react, typescript

Research direction

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.

Written by the indexing model from the issue text.

Description

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%" with viewBox="0 0 <screenWidth> <height>", so a width change scales the existing drawing.
  • ResizeObserver sees the new size, but the redraw goes through scheduleRender(), which waits for requestAnimationFrame (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
  1. Render <Chart definition={…} height={320} ariaLabel="…" /> in a container with a percentage width.
  2. Open print preview in a viewport wider than the page, or call page.pdf({ format: 'A4' }) on a 1200px-wide page.
  3. 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.

Dominant language
TypeScript
Stars
819
Forks
49
Avg merge
4h 40m
Merged PRs (30d)
16

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from TanStack/charts

All issues in TanStack/charts

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.