antvis / antvis/G2Plot

🐛 [BUG] 分面图子视图 type 为 bar 的时候坐标轴显示错误

Open
#3,675 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]

![image](https://github.com/antvis/G2Plot/assets/25362141/bfb35810-a080-4b6e-9cfc-b28b65efda12)

二维行列(矩形)分面 的坐标轴显示错误

* _Required_ **Link to minimal reproduction**:

### 📷 Step to reproduce
1. 打开官网链接 [二维行列(矩形)分面 ](https://g2plot.antv.antgroup.com/examples/plugin/facet#rect)
2. `scatter` 修改为 `bar` 即可复现
示例代码:
```
import { Facet } from '@antv/g2plot';

fetch('https://gw.alipayobjects.com/os/antvdemo/assets/data/diamond.json')
.then((res) => res.json())
.then((data) => {
const plot = new Facet('container', {
type: 'rect',
fields: ['cut', 'clarity'],
cols: 3, // 超过3个换行
padding: [0, 10, 10],
appendPadding: 30,
data,
axes: {},
meta: {
carat: {
sync: true,
},
price: {
sync: true,
},
cut: {
// 设置 sync 同步之后,可以按照 'cut' 进行颜色映射分类
sync: true,
},
},
eachView: (view, f) => {
return {
type: 'bar',
options: {
data: f.data,
xField: 'carat',
yField: 'price',
colorField: 'cut',
shape: 'circle',
pointStyle: { fillOpacity: 0.3, stroke: null },
},
};
},
});
plot.render();
});

```

### 🏞 Expected result
正确的结果应该是第一列显示 Y 坐标轴, 最后一行显示 X 坐标轴。

### 🚑 Any additional [like screenshots]

* **G2Plot Version**: 2.4.25
* **Platform**: 谷歌浏览器

Contributor guide

Open the contributing guide

Research direction

Open the linked two-dimensional rectangular facet example and reproduce the issue by changing the inner chart from scatter to bar. Start by tracing the facet axis behavior around the eachView configuration; done means the first column shows the Y axis and the last row shows the X axis as expected.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.