[FEATURE]: Flexible tick label positioning on categorical axes (anchoring + between-category placement)
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- JavaScript
- Star
- 18.3k
- Fork
- 2k
- Merge trung bình
- 2 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 28
Mô tả
Description
Add support for more flexible positioning of tick labels on categorical axes, to correctly handle grouped or hierarchical categories—especially when groups contain an even number of items.
Specifically, this request proposes:
- Configurable horizontal text anchoring for tick labels (left, center, right), and
- Optional placement of tick labels at fractional (non‑data) axis positions, i.e. between two categorical ticks.
Currently, tick labels are always centre‑anchored on discrete tick positions, which prevents accurate or visually correct centring for even‑sized groups.
Why should this feature be added?
This is a recurring UX limitation in real‑world charts that use:
- grouped or hierarchical categorical axes,
- experimental or test‑matrix layouts,
- manufacturing and operational visualisations.
For even‑sized groups, the true visual centre lies between two categories, but:
- tick labels cannot be placed between ticks,
- text anchoring cannot be adjusted,
- whitespace or HTML hacks are neutralised by automatic centring,
- annotations are not a clean substitute for tick labels.
Providing:
- anchor control (left / centre / right) would address many alignment issues with minimal complexity, while
- fractional tick‑label positioning would solve the problem exactly for grouped categories.
Together, these features would significantly improve readability, reduce workarounds, and enable precise hierarchical labelling without breaking Plotly’s axis model.
Mocks / Designs
Conceptually:
- a grouped label whose left edge aligns with a group boundary (e.g. at x = 1.5),
- or a label centred between two categorical ticks rather than on a data point.
A simple screenshot of a grouped categorical axis with an even number of categories clearly illustrates the current limitation.
Notes
- Applicable to plotly.js and all language bindings (Python, R, etc.).
- Most visible when compressing or centring hierarchical tick labels.
- Proposed as:
- Primary feature: tick‑label horizontal anchoring
- Advanced extension: fractional / between‑category tick placement
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.
Hướng nghiên cứu
Issue không nêu tên tệp, test hoặc entry point nào; hãy bắt đầu bằng cách xác định phần kết xuất nhãn tick của trục phân loại và các test hiện có của phần đó trong plotly.js. Xác định phạm vi giữa neo ngang và định vị phân số, sau đó xác minh rằng các nhãn phân loại được nhóm có thể được căn trái, căn giữa hoặc căn phải, và các vị trí giữa các phân loại hoạt động chính xác.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript
- Lĩnh vực
- data-visualization
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 38/100