Axis tick stubs: no style option, and `ticks: false` also hides the 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ó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 54/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ệ
- typescript
- Lĩnh vực
- data-visualization
Hướng nghiên cứu
Start by reading the axis rendering and tick-count logic in dist/scene.js at the locations cited in the issue, then inspect ChartAxisTickOptions. Compare the two minimal repros with the expected behavior; the issue leaves open whether stubs should inherit the axis line style or get their own option. Done when stub styling and the effect of ticks: false versus { size: 0 } are resolved and documented clearly.
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
Problem
(a) Tick stubs ignore the axis line style and have no style of their own
https://github.com/TanStack/charts/pull/148 added ChartGuideLineStyle (stroke, strokeOpacity, strokeWidth, strokeDasharray, lineCap) for grid and the axis line. The tick stubs do not get it.
In dist/scene.js the axis line uses axisStyle(presentation?.line) (lines 933 and 1017), but each tick stub uses axisStyle() with no argument (lines 973 and 1057). So a stub is always theme.foreground at strokeOpacity: 0.28. ChartAxisTickOptions has count, spacing, values, size, padding, format and motion, but no style.
Result: if you color the axis line, the stubs keep the default color, and you cannot match them.
(b) ticks: false hides the labels too, and changes the tick count
tickLabelPresentation returns false when axis.ticks === false (dist/scene.js, about line 1155), so the labels go away with the stubs. resolveTickCount also uses a different fallback count when ticks is false (about line 1127).
Users who come from Recharts (tickLine={false}) or from D3 think of "ticks" as the stub lines. They write ticks: false to remove the stubs, and lose the labels. The correct option is ticks: { size: 0 }, but we found it only by reading the source.
Minimal repro
import { defineChart, lineY } from '@tanstack/charts';
import { scaleLinear } from '@tanstack/charts/scales/linear';
const rows = [
{ x: 0, y: 1 },
{ x: 1, y: 3 },
{ x: 2, y: 2 },
];
// (a) The axis line is red, the stubs stay at the default color.
export const styled = defineChart({
marks: [lineY(rows, { x: 'x', y: 'y' })],
scales: {
x: {
scale: scaleLinear,
axis: { line: { stroke: 'red', strokeOpacity: 1 } },
},
y: { scale: scaleLinear },
},
});
// (b) The stubs and the labels both disappear.
export const noStubs = defineChart({
marks: [lineY(rows, { x: 'x', y: 'y' })],
scales: {
x: { scale: scaleLinear, axis: { ticks: false } },
y: { scale: scaleLinear },
},
});
Expected
- (a) A way to style the stubs, for example a
ticks.line?: ChartGuideLineStyle | false. Or the stubs inherit the axislinestyle. - (b) The docs say clearly that
ticks: falseremoves the labels too, and thatticks: { size: 0 }removes only the stubs. Aticks.line: falsefrom (a) would make this more obvious.
Actual
- (a) The stubs always use the theme foreground at 0.28 opacity.
- (b)
ticks: falseremoves the labels and changes the tick count.
Our workaround
We set ticks: { size: 0 } on each axis that had tickLine={false} in Recharts. We have no workaround for (a), but our designs did not need styled stubs after we removed them.
Related
- https://github.com/TanStack/charts/issues/131 (grid and axis stroke treatment, closed)
- https://github.com/TanStack/charts/pull/148 (static guide line styles, merged)
Written by an agent (Claude Code, claude-opus-5-5).
- Ngôn ngữ chính
- TypeScript
- Star
- 769
- Fork
- 47
- Merge trung bình
- 6 giờ 9 phút
- Pull request đã merge (30 ngày)
- 20
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
-
Renderer treats a sub-pixel width difference as a resize, which cancels the `motion()` entranceĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
brushX with `values` can shorten the selection range when it’s dragged to the plot edgeCó thể đã có người làm @andersk đã nhận 2 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
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 35/100
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 52/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày 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
Tất cả issue của TanStack/charts
Issue tương tự
-
[Bug]: Server git tests sign fixture commits with the developer's key when run from the repo rootĐ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
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
melgarafael/DeskcommCRM#2657 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
MystenLabs/MemWal#1163 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Mondriaan
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
knaw-huc/textannoviz#709 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
billion-context-pi
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
ranxianglei/billion-context#2521 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày