Label Text Width Fit Feature Request

Đang mở
#21,607 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
Ít trao đổi
Công nghệ
typescript

Hướng nghiên cứu

Issue không nêu tên tệp, kiểm thử hoặc entry point nào. Hãy bắt đầu bằng việc xác định các đường dẫn render label và rich text, sau đó định nghĩa và xác thực một API điều chỉnh văn bản theo chiều ngang cho các label có chiều rộng cố định trong markPoint và các component liên quan; công việc được xem là hoàn tất khi behavior và API được tài liệu hóa và có kiểm thử bao phủ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

new-feature
What problem does this feature solve?

Currently, ECharts provides width and overflow properties (like truncate or break) for labels in markPoint, markLine, and other components. However, there is no native way to force text to fit a specific container width by stretching or narrowing the glyphs themselves (horizontal scaling).

In many UI designs—specifically when using markPoint with custom symbols like pins or boxes—we have a fixed-width area for text.

  1. Truncation (truncate) hides important information.
  2. Wrapping (break) often breaks the visual layout or overflows the symbol vertically.
  3. Font-size reduction is a common workaround, but it requires manual calculation of string lengths and doesn't guarantee a "flush" look on both sides.

I am looking for a feature similar to the SVG attribute textLength with lengthAdjust="spacingAndGlyphs" or the CSS text-stretch property. This would allow the text to horizontally scale to fill the exact width provided without changing the font height.

What does the proposed API look like?

I propose adding a property to the label or rich text styles, perhaps called fontStretch or an option within overflow.

Option A (New Property):

label: {
  show: true,
  width: 50,
  // This would stretch or compress the text to be exactly 50px wide
  fontStretch: 'fit' 
}

**Option B (Enhancing Overflow):**
label: {
  show: true,
  width: 50,
  overflow: 'fit' // A new option that scales the text width to match the defined width
}
Ngôn ngữ chính
TypeScript
Star
67.7k
Fork
19.9k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/echarts

Tất cả issue của apache/echarts

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.