antvis / antvis/G2

图例过长会导致图表UI显示有问题, 分页器也看不见了

Open
#6,407 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
12.6k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

### 问题描述

当图例设置了一个非常长的名称时, 会导致图表显示上有问题
为什么要设置那么长的名称? 因为我的业务场景用上了, 泪目

### 重现链接

https://g2.antv.antgroup.com/examples/interaction/component#legend

### 重现步骤

设置一个非常长的字符串, 在配置 color 的 encode 里面

### 预期行为

我的预期, 有两种:
1. 将超出的文本使用省略符号 ...
2. 隐藏/取消分页器, 一行只显示一个图例并通过换行的方式显示所有文本, 通过一个固定宽高的容器将那些图例包起来, 通过滚动条滑动方式查看显示的所有文本和所有的图例. (这个我强烈推荐)

### 平台

- 操作系统: [Windows]
- 网页浏览器: [Google Chrome]
- AntV G2版本: [5.2.3]

### 屏幕截图或视频(可选)

![微信图片_20240821151055](https://github.com/user-attachments/assets/4b1e7b3a-eca2-4e33-a11e-3968c99296fa)

![微信图片_20240821151412](https://github.com/user-attachments/assets/a0c0eb81-8f03-4c04-8efc-b56ed4460482)

### 补充说明(可选)

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the legend example at https://g2.antv.antgroup.com/examples/interaction/component#legend and reproduce the issue using a very long string in the color encode configuration. Inspect the legend layout and pagination behavior; done means long labels no longer break the chart UI or hide the pager, using an agreed truncation or wrapping-and-scroll behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.