[Bug]: 图例与正图中的点 shape 不一致
- Dominant language
- TypeScript
- Stars
- 12.6k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the bug / 问题描述
数据点只有形状映射时,目前图例中点的形状与正图不一致。
### Reproduction link / 复现链接
_No response_
### Steps to Reproduce the Bug or Issue / 重现步骤
可重复例子如下:
```html
const chart = new G2.Chart({
"width": 640,
"height": 480,
"autoFit": true,
"container": "gglite-1775072089-714683"
});
chart.options({
"data": [{
"x": 1,
"y": 2,
"z": "point"
}, {
"x": 2,
"y": 3,
"z": "plus"
}, {
"x": 3,
"y": 4,
"z": "diamond"
}],
"children": [
{
"type": "point",
"encode": {
"x": "x",
"y": "y",
"shape": "z",
"size": 10
},
}
],
});
chart.render();
```
可以看到图中用的是圆圈、菱形、六边形,而图例显示的却是正方形、上三角、下三角:
这个问题在加上 `color: "z"` 映射后会消失,上色的点不存在图例和图不匹配的问题:
或者强行指定 scale:
```json
"scale": {
"shape": {
"range": ["point", "plus", "diamond"]
}
}
```
我觉得这应该是个明显的 bug。数据点只有形状映射时,图例中的形状应该与图保持一致。
### Version / 版本
🆕 5.x
### OS / 操作系统
- [x] macOS
- [x] Windows
- [x] Linux
- [x] Others / 其他
### Browser / 浏览器
- [x] Chrome
- [ ] Edge
- [ ] Firefox
- [ ] Safari (Limited support / 有限支持)
- [ ] IE (Nonsupport / 不支持)
- [ ] Others / 其他
Contributor guide
Research direction
Use the reproduction in the issue to render a point chart with only a shape mapping, then compare the displayed point shapes with the legend. Check how shape scales and legend symbols are derived, including the reported cases where adding color mapping or explicitly setting the shape scale range makes them match. Done means the legend shows the same shapes as the chart for the reproduction.
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
- Clearly specified
- Newbie friendliness
- 55/100