antvis / G2

📊 The concise and progressive visualization grammar.
https://g2.antv.antgroup.com
MIT License
12.07k stars 1.58k forks source link

[V5]设置柱状图的最大宽度,联通区域不会跟随柱子宽度进行调整 #5500

Open ChenKun1997 opened 12 months ago

ChenKun1997 commented 12 months ago

代码(直接粘贴在官网示例中跑):

import { Chart } from '@antv/g2';

const chart = new Chart({
  container: 'container',
  autoFit: true,
});

chart
  .interval()
  .data({
    type: 'fetch',
    value:
      'https://gw.alipayobjects.com/os/antfincdn/8elHX%26irfq/stack-column-data.json',
  })
  .transform({ type: 'stackY' })
  .transform({ type: 'sortX', by: 'y', reverse: true })
  .encode('x', 'year')
  .encode('y', 'value')
  .encode('color', 'type')
  .style({
    maxWidth:80
  })
  chart.interaction('elementHighlightByColor', {
  link: true,
}).state('active', { fill: 'red', linkFillOpacity: 0.5 })
  .state('inactive', { opacity: 0.5 });

chart.render();
pearmini commented 11 months ago

目前联通区域是和 Band 有关系的,但是固定宽高没有走 band 比例尺的逻辑。