[Feature] Mark states: geometry keys (scale, translate, arc angles and radii)

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

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

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
42/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
d3, typescript

調査の方向性

Read packages/charts-core/src/types.ts and packages/charts-core/src/mark-state.ts, then trace how state transitions apply and tween style values for area and polar marks. Check the polar mark implementation and related state tests to identify the geometry paths involved. Done means the proposed scale and translate keys work for area-kind marks, polar geometry keys are supported, and state transitions tween them.

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

説明

Version: @tanstack/charts 1.1.0 (57774e1). Split from #186 (comment section E) and #194 (section D) so it can be closed on its own; it also covers what remained of #126 after polar states shipped.

Common hover effects (an arc that grows 3%, a radar polygon at 1.05x, a funnel segment that pops) cannot be written as states; they need a custom spring on renderer-owned DOM.

What exists
  • ChartMarkStateStyle has r (dot), radius and inset (bar, rect) and dx, dy, rotate (text), per the per-mark picks (types.ts:176-260, applied in mark-state.ts:205-235).
  • Marks that render as area nodes (radialArc, sunburst sectors, areaY) have no geometry key at all (ChartAreaStateStyle is paint only), and no mark has a scale or translate key.
  • The group-states doc says the same: "Group states support paint; geometry properties such as dot radius and text rotation apply only to their corresponding leaves" (custom-extensions.md:221-223).
  • Polar marks accept states (polar.ts:229-230, polar.md:52-60), but ChartMarkStateStyle has no startAngle, endAngle, innerRadius or outerRadius.
Ask

Add an optional scale (about the node's own centre or a given origin) and translate to ChartMarkStateStyle for area-kind marks, and for polar arcs innerRadius/outerRadius or startAngle/endAngle, resolved in applyStateStyle and tweened by the state transition.

Example (proposed API; outerRadius is the new key):

radialArc(rows, {
  startAngle: 'start', endAngle: 'end', innerRadius: 60, outerRadius: 80,
  states: [{ when: { focus: 'primary' }, style: { outerRadius: 84 }, transition: { type: 'spring', stiffness: 400, damping: 30 } }],
})

Read from source, not run.

Related: #186 (cost of state changes), #194 (arc motion), #126 (polar states).

主要言語
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 を短くまとめたダイジェスト。