Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#228 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@piecyk がすでに取り組んでいます。

2026年10月14日 から。

  • #229 @piecyk による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
d3, react, typescript

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
TypeScript
スター
819
フォーク
49
平均マージ
4時間 40分
マージ済み PR(30日)
16

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TanStack/charts のほかの issue

TanStack/charts の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。