antvis / G2Plot

:dango: An interactive and responsive charting library based on G2.
https://g2plot.antv.antgroup.com
MIT License
2.55k stars 604 forks source link

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

Open lethe-river opened 2 years ago

lethe-river commented 2 years ago

🐛 Bug description [Please make everyone to understand it]

Please provide a link by forking these links G2Plot or GitHub repo, a minimal reproduction.

📷 Step to reproduce

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

🚑 Any additional [like screenshots]

Eve-Sama commented 2 years ago

标题没有内容吗?

lethe-river commented 2 years ago

标题没有内容吗?

image 显示是这样的

Eve-Sama commented 2 years ago

我是说issue标题.

lethe-river commented 2 years ago

我是说issue标题.

抱歉,刚刚改了标题