🐛 [BUG] 分组柱形图配置了 meta values 后,图形向左偏移
- 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]
> 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.
* _Required_ **Link to minimal reproduction**:
### 📷 Step to reproduce
代码:
```typescript
import { GroupedColumn } from '@antv/g2plot';
const data = [
{
name: 'base',
bucket: '-4',
count: 1,
},
{
name: 'base',
bucket: '-1',
count: 1,
},
{
name: 'feature',
bucket: '0',
count: 4,
},
{
name: 'base',
bucket: '0',
count: 1,
},
]
const columnPlot = new GroupedColumn(document.getElementById('container'), {
title: {
visible: true,
text: '分组柱状图',
},
forceFit: true,
data,
xField: 'bucket',
yField: 'count',
yAxis: {
min: 0,
},
label: {
visible: true,
},
groupField: 'name',
meta: {
bucket: { values: ['-4', '-2', '-1', '0', '1', '2', '3'] },
},
color: ['#1ca9e6', '#f88c24'],
})
columnPlot.render()
```
渲染结果:

### 🏞 Expected result
### 🚑 Any additional [like screenshots]
* **G2Plot Version**:
* 官网
* **Platform**:
* macOS Edge 94
Contributor guide
Research direction
Start with the supplied TypeScript reproduction using GroupedColumn and the bucket meta.values configuration. Compare the rendered grouped bars with and without the configured values, then trace the chart behavior responsible for category positioning. Done means the grouped columns no longer shift left when the meta values include categories not present in the data.
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
- Needs clarification
- Newbie friendliness
- 35/100