【V5 Bug】Y轴离散时,框选结果与视觉不符合
- Dominant language
- TypeScript
- Stars
- 12.6k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
### 问题描述
# 如题
## 感觉框选运算时未考虑上下翻转
代码如下
```javascript
/**
* A recreation of this demo: https://observablehq.com/@d3/scatterplot-with-shapes
*/
import { Chart } from '@antv/g2';
const data = [
{
x: 0.8,
y: 'A'
},{
x: 1,
y: 'A'
},
{
x: 2,
y: 'B'
},
{
x: 3,
y: 'C'
}]
const chart = new Chart({
container: 'container',
autoFit: true,
});
chart
.point()
.data(data)
.encode('x', 'x')
.encode('y', 'y')
.interaction('brushHighlight', {})
.scale({
x: {
domain: [0.5, 5]
},
y: {
range: [1, 0]
}
})
chart.on('brush:end', e => {
console.log(e.data.selection)
})
chart.render();
```
## 操作及效果如下

### 重现链接
_No response_
### 重现步骤
_No response_
### 预期行为
结果:框选不对应;
期望:框选区域和实际轴对应;
### 平台
- 操作系统: [macOS, Windows, Linux, React Native ...]
- 网页浏览器: [Google Chrome, Safari, Firefox]
### 屏幕截图或视频(可选)
_No response_
### 补充说明(可选)
_No response_
Contributor guide
Research direction
Start with the provided G2 point-chart example and the brushHighlight interaction, then inspect how brush:end produces e.data.selection when the y scale uses range [1, 0]. Reproduce the selection mismatch and verify that the reported selection corresponds to the visibly brushed region on the discrete, vertically reversed axis.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100