antvis / antvis/G2Plot

🐛 [BUG]设置图例的背景,只有第一个生效了

Open
#3,228 1 comment 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]
想要给图例设置背景色,但是只第一个生效了

图例配置如下
`legend: {
position: 'right',
itemHeight: 30,
background: {
style: {
stroke: null,
fill: 'green',
}
}
}`

> 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.

基于这个示例: https://codesandbox.io/s/epic-sea-8yrxoj?file=/index.js

* _Required_ **Link to minimal reproduction**:

### 📷 Step to reproduce

### 🏞 Expected result

### 🚑 Any additional [like screenshots]

* **G2Plot Version**:
* **Platform**:

Contributor guide

Open the contributing guide

Research direction

Start with the linked CodeSandbox reproduction, especially index.js, and inspect how the legend background configuration is applied when multiple legend items are rendered. Done means the configured green background appears for every legend item rather than only the first.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.