[Feature] `fillOpacity` and `strokeOpacity` as per-datum channels, and `fill` on `rect`

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

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

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
typescript

調査の方向性

Start with the channel definitions in packages/charts-core/src/rect.ts, bar.ts and dot.ts, then trace how marks pass visual channels into rendering and motion updates. Compare rect with barY and barX to identify the relevant types and tests. Done when per datum fillOpacity and strokeOpacity work on all four marks and rect accepts a per datum fill channel.

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

説明

Version: @tanstack/charts 1.5.0 (b236dae).

A mark cannot draw its data at different opacities.

  • fillOpacity and strokeOpacity are numbers on rect, barY, barX and dot (rect.ts:48, bar.ts:70, dot.ts:52).
  • fill is a VisualChannel on bars but a constant on rect (bar.ts:69, rect.ts:47).
  • Mark states take a per-datum fillOpacity, but wait while data motion is active (motion.md:77), so they never apply in a chart that updates on every frame.

Use case: dimming the marks outside a range while the range is dragged.

The workaround is one mark for each datum:

marks: rows.map((row) =>
  rect([row], { id: `bar-${row.key}`, x1: 'x1', x2: 'x2', y1: 'y1', y2: 'y2', key: 'key', fillOpacity: row.opacity }),
)

The opacity tweens, but each update costs up to twice as much. Median synchronous host.update under motion(), headless Chromium 153, values changing and nothing else:

Bars One mark One mark for each bar
48 1.8 ms 2.4 ms
192 7.1 ms 13.1 ms
768 57.4 ms 116.4 ms
Ask
  • fillOpacity as VisualChannel<TDatum, number> on rect, barY, barX and dot, and strokeOpacity likewise.
  • fill as VisualChannel<TDatum, string> on rect, as bars have.
主要言語
TypeScript
スター
870
フォーク
57
平均マージ
11時間 58分
マージ済み PR(30日)
18

環境構築

はじめの一歩

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

TanStack/charts のほかの issue

TanStack/charts の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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