Feature request: a framework render slot for axis tick labels
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- react, typescript
- Lĩnh vực
- data-visualization
Hướng nghiên cứu
Start by reading the axis tick configuration under scales.y and the existing tooltip render path, RendererChart from @tanstack/charts/react/tooltip. The issue suggests either an axis render slot or exposing resolved tick positions and the plot rect, so the API and layout behavior still need design. Done means framework-rendered tick labels can be positioned and sized by the chart without duplicating plot layout math.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version: @tanstack/charts 1.0.0, React adapter
Problem
Tick labels are SVG text. ticks.format returns a string. There is no way to render a framework component (an icon, an image, a styled badge) as a tick label.
Recharts lets you pass a component as tick. We used this for an Elo chart. Each y tick shows a skill level icon and the Elo value next to it. Each x tick on one variant shows a styled match result marker.
The tooltip already has a framework render path (RendererChart from @tanstack/charts/react/tooltip). Tick labels do not.
Our workaround
We hide the axis labels in the chart and render them as HTML over the plot. The component must know the plot layout:
- the y position of each tick, as a fraction of the y domain
- the x position of each tick, as a fraction of the x domain
- the plot insets and the x padding, so that the HTML labels line up with the SVG plot
Simplified from our code:
// Our own copy of the plot insets (example values). It must match the
// chart definition.
const layout = { top: 8, bottom: 24, start: 72, end: 8, xPadding: 12 };
<Frame>
<Chart definition={definition} ariaLabel={label} height={height} />
<YAxisLayer
style={{
insetBlock: `${layout.top}px ${layout.bottom}px`,
inlineSize: layout.start - TICK_GAP,
}}
>
{yTicks.map(tick => (
<SkillTick key={tick} value={tick} offset={getYFraction(yDomain, tick)} />
))}
</YAxisLayer>
<PlotLayer
style={{
insetBlock: `${layout.top}px ${layout.bottom}px`,
insetInline: `${layout.start + layout.xPadding}px ${layout.end + layout.xPadding}px`,
}}
>
{rows.map(row => (
<ResultTick key={row.x} row={row} position={getXFraction(xDomain, row.x)} />
))}
</PlotLayer>
</Frame>
This works, but:
- We copy the scale math and the plot insets into the component. If the library changes its layout, the labels move away from the plot.
- The library cannot measure the labels, so we reserve the label space by hand (a fixed gap and a fixed width).
- The labels are not part of the chart accessibility tree.
Suggested API
A render slot on the axis, for the adapters that support it. For example:
scales: {
y: {
scale: scaleLinear,
axis: {
ticks: {
render: tick => <SkillTick value={tick.value} />,
// the space the library reserves for each label
size: { width: 64, height: 24 },
},
},
},
},
The library positions each slot at the tick, like it does for the tooltip. An alternative is to expose the resolved tick positions and the plot rect to the framework layer (for example through a callback or a hook), so that an overlay does not have to copy the math.
Written by an agent (Claude Code, claude-opus-5-5).
- Ngôn ngữ chính
- TypeScript
- Star
- 842
- Fork
- 53
- Merge trung bình
- 4 giờ 40 phút
- Pull request đã merge (30 ngày)
- 16
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của TanStack/charts
-
[Bug] Focus guides: `url(#id)` paints ignore `idPrefix`Có thể đã có người làm @getdownandcode đã nhận 7 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
TanStack/charts#211 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] Printed charts keep their screen width: resize redraw waits for an animation frameCó thể đã có người làm @piecyk đã nhận 7 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Feature] Readable outside labels for crowded pie and donut chartsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
TanStack/charts#227 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 42/100
TanStack/charts#216 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 57/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của TanStack/charts
Issue tương tự
-
Edit: Tele Posadas HDĐang mởcheck:passed streams:edit
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area:mcp bug has repro platform:vscode regression
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
anthropics/claude-code#103970 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
skillopt: success-reflect prompt omits the edit schema, so every success-only edit is droppedĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Workspace secrets/constants containing "$" are corrupted when resolved in data source optionsĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
sdk-typescript: unquoted COPY globs in shell form are silently dropped from the image build contextĐang mởbug javascript
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày