antvis / antvis/G2Plot

分组条形图柱子间距 [BUG]

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

> 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
```js
import { Bar } from '@antv/g2plot';

const data = [
{
label: 'Mon.',
type: 'series1',
value: 2800,
},
{
label: 'Mon.',
type: 'series2',
value: 2260,
},

];

const stackedBarPlot = new Bar('container', {
data,
isGroup: true,
xField: 'value',
yField: 'label',
seriesField: 'type',
dodgePadding: 4,
label: {
// 可手动配置 label 数据标签位置
position: 'middle', // 'left', 'middle', 'right'
// 可配置附加的布局方法
layout: [
// 柱形图数据标签位置自动调整
{ type: 'interval-adjust-position' },
// 数据标签防遮挡
{ type: 'interval-hide-overlap' },
// 数据标签文颜色自动调整
{ type: 'adjust-color' },
],
},
});

stackedBarPlot.render();
```
当data数据只有一组时,显示空白;将dodgePadding: 4, 删除后,则显示正常

### 🏞 Expected result
![image](https://user-images.githubusercontent.com/52186159/145359062-0c1f07bd-e0fa-4112-ad45-68a2a95286f6.png)

### 🚑 Any additional [like screenshots]

* **G2Plot Version**: 2.3.40
* **Platform**: win10 64

Contributor guide

Open the contributing guide

Research direction

Start with the provided Bar configuration and minimal reproduction, focusing on grouped-bar layout when only one series is present and dodgePadding is set. Reproduce the blank chart in G2Plot 2.3.40, then trace the grouped layout entry point to identify the affected behavior. Done means the single-series grouped bar renders correctly with dodgePadding while existing grouped cases remain unchanged.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.