antvis / antvis/G2Plot

🐛 [BUG] 如果brush宽度过大,会导致线段重叠

Open
#3,717 0 comments 0 reactions 0 assignees View on GitHub
Bug
Dominant language
TypeScript
Stars
2.7k
Forks
591
PR merge metrics
No merged PRs in 30d

Description

### 🐛 Bug description [Please make everyone to understand it]
以此情况作为brush的空间:
image
brush结果如下,部分线段被重叠了:
image
但是如果选取空间较小还是正常的,效果如下:
image
image

> Please provide a link by forking these links [G2Plot](https://codesandbox.io/s/g2plot-issue-template-gzfdq?file=/index.ts) or GitHub repo, a minimal reproduction.

### 📷 Step to reproduce
配置图表的代码如下:
```js
;(async function () {
const data = await getTag(props.sources[0])
chart = new Line(g2.value, {
data,
padding: 'auto',
xField: 'step',
yField: 'data',
// 坐标轴相关
xAxis: {
// type: 'timeCat',
tickCount: 5 // 设置坐标轴刻度数量,防止数据过多导致刻度过密
},
yAxis: {},
// 大小相关
height: 200,
autoFit: true,
// 开启一些交互
interactions: [{ type: 'brush-x' }],
// 样式相关
// smooth: true, // 平滑曲线
color: experimentColor.value
})

chart.render()
})()
```
data的数据结构类似:
```
[
{
step:1,
data: 1
},
....
]
```

### 🏞 Expected result

我希望线段不要被重叠

Contributor guide

Open the contributing guide

Research direction

Start with the Line chart configuration and the `brush-x` interaction shown in the reproduction, then run the example with a large brush area to observe the overlapping segments. Trace the brush behavior until the affected line rendering path is identified; done means large brush selections no longer overlap segments while the smaller selection remains correct.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.