antvis / antvis/G2

[Bug]: 图例展示异常

Open
#7,250 1 comment 0 reactions 0 assignees View on GitHub
bug 🐛 P2
Dominant language
TypeScript
Stars
12.6k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug / 问题描述

Image

图例缺失

```ts
{
const config = {
"type": "view",
"scale": {},
"children": [
{
"data": [
{
"time": "202501",
"value": 0.4846223623220571,
"type": "prediction_score_2ca3d1cb/通用3m30d_身份证号/整体/yx_mybk_rm_dev.x_375693_dq_v6_pred_1204_2_0_30_2.prediction_score",
"originValue": 0.4846223623220571
},
{
"time": "202501",
"value": 0.5241715962498887,
"type": "prediction_score_2ca3d1cb/通用1m30d_身份证号/整体/yx_mybk_rm_dev.x_375693_dq_v6_pred_1204_2_0_30_2.prediction_score",
"originValue": 0.5241715962498887
},
{
"time": "202501",
"value": 0.4073719140751409,
"type": "final_prob_2ca3d1cb/通用3m30d_身份证号/整体/yx_mybk_rm_dev.x_375693_dq_v6_pred_1204_2_0_30_2.final_prob",
"originValue": 0.4073719140751409
},
{
"time": "202501",
"value": 0.428439604901525,
"type": "final_prob_2ca3d1cb/通用1m30d_身份证号/整体/yx_mybk_rm_dev.x_375693_dq_v6_pred_1204_2_0_30_2.final_prob",
"originValue": 0.428439604901525
},
{
"time": "202502",
"value": 0.48549450926322646,
"type": "prediction_score_2ca3d1cb/通用3m30d_身份证号/整体/yx_mybk_rm_dev.x_375693_dq_v6_pred_1204_2_0_30_2.prediction_score",
"originValue": 0.48549450926322646
},
{
"time": "202502",
"value": 0.5119367768314642,
"type": "prediction_score_2ca3d1cb/通用1m30d_身份证号/整体/yx_mybk_rm_dev.x_375693_dq_v6_pred_1204_2_0_30_2.prediction_score",
"originValue": 0.5119367768314642
},
{
"time": "202502",
"value": 0.4065108130743259,
"type": "final_prob_2ca3d1cb/通用3m30d_身份证号/整体/yx_mybk_rm_dev.x_375693_dq_v6_pred_1204_2_0_30_2.final_prob",
"originValue": 0.4065108130743259
},
{
"time": "202502",
"value": 0.41804945688452333,
"type": "final_prob_2ca3d1cb/通用1m30d_身份证号/整体/yx_mybk_rm_dev.x_375693_dq_v6_pred_1204_2_0_30_2.final_prob",
"originValue": 0.41804945688452333
},
{
"time": "202503",
"value": 0.5035093885244725,
"type": "prediction_score_2ca3d1cb/通用3m30d_身份证号/整体/yx_mybk_rm_dev.x_375693_dq_v6_pred_1204_2_0_30_2.prediction_score",
"originValue": 0.5035093885244725
},
{
"time": "202503",
"value": 0.5310100823455524,
"type": "prediction_score_2ca3d1cb/通用1m30d_身份证号/整体/yx_mybk_rm_dev.x_375693_dq_v6_pred_1204_2_0_30_2.prediction_score",
"originValue": 0.5310100823455524
},
{
"time": "202503",
"value": 0.4353751688533189,
"type": "final_prob_2ca3d1cb/通用3m30d_身份证号/整体/yx_mybk_rm_dev.x_375693_dq_v6_pred_1204_2_0_30_2.final_prob",
"originValue": 0.4353751688533189
},
{
"time": "202503",
"value": 0.4443267368092356,
"type": "final_prob_2ca3d1cb/通用1m30d_身份证号/整体/yx_mybk_rm_dev.x_375693_dq_v6_pred_1204_2_0_30_2.final_prob",
"originValue": 0.4443267368092356
}
],
"type": "line",
"style": {
"lineWidth": 2
},
"axis": {
"x": {
"labelAutoHide": true,
"labelAutoRotate": false,
"title": false
},
"y": {
"title": false,
"tick": false
}
},
"height": 300,
"scale": {
"y": {
"domainMin": 0,
"key": "child0Scale",
"independent": true,
"nice": true
}
},
"overlapHide": true,
"scaleConfig": {},
"interaction": {
"tooltip": {}
},
"legend": {
"cols": 1,
"orientation": "vertical",
"position": "left",
"color": true
},
"encode": {
"x": "time",
"y": "value",
"color": "type"
},
"labels": [
{
"__transform__": true,
"style": {
"dy": -10,
"textAlign": "middle"
},
"transform": [
{
"type": "overlapHide"
}
]
}
]
}
]
}
```

### Reproduction link / 复现链接

_No response_

### Steps to Reproduce the Bug or Issue / 重现步骤

_No response_

### Version / 版本

Please select / 请选择

### OS / 操作系统

- [ ] macOS
- [ ] Windows
- [ ] Linux
- [ ] Others / 其他

### Browser / 浏览器

- [ ] Chrome
- [ ] Edge
- [ ] Firefox
- [ ] Safari (Limited support / 有限支持)
- [ ] IE (Nonsupport / 不支持)
- [ ] Others / 其他

Contributor guide

Open the contributing guide

Research direction

The issue provides a TypeScript chart configuration and an image, but no reproduction link, steps, version, browser, or named files and tests. Start by reproducing the configuration and inspect the legend behavior for the line chart. Done means the legend is displayed correctly for the encoded type values.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.