[Bug] Printed charts keep their screen width: resize redraw waits for an animation frame
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 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%"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.
- 主要言語
- TypeScript
- スター
- 819
- フォーク
- 49
- 平均マージ
- 4時間 40分
- マージ済み PR(30日)
- 16
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
TanStack/charts のほかの issue
-
[Bug] Focus guides: `url(#id)` paints ignore `idPrefix`対応中かも @getdownandcode が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
TanStack/charts#211 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Feature] Readable outside labels for crowded pie and donut charts対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
TanStack/charts#227 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 42/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 57/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
TanStack/charts の issue をすべて見る
似ている issue
-
documentation good first issue
難易度 2/5 半日 初心者へのやさしさ 72/100
sujithputta02/Esapay#13 ·
-
Share dialog: the address book's contact count reads "1 contacts" (no singular form in any language)対応中かも @chibenwa が今日担当しました。 オープンai-driven-qa bug claude Cosmetic
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
linagora/twake-contacts-frontend#271 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Koenkk/zigbee2mqtt#33402 ·
メンテナーはふだん 1 日以内に返信
-
dx P2 platform Stellar Wave Wave 10
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
winsznx/routedock#579 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area:ui effort:S enhancement priority:P2
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信