antvis/G2

怎么设置 series 柱子之间的距离 #5971

YY88Xu posted onGitHub

问题描述

<img width="1145" alt="image" src="https://github.com/antvis/G2/assets/14836228/151e932e-46f7-4c39-b012-c58ea438388f"> 如图,怎么设置 series 柱子之间的距离

重现链接

No response

重现步骤

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

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

const data = [
  { time: '10:10', call: 4, waiting: 2, people: 2 },
  { time: '10:15', call: 2, waiting: 6, people: 3 },
  { time: '10:20', call: 13, waiting: 2, people: 5 }
];

chart.data(data);

chart
  .interval()
  .style('maxWidth', 40)
  .encode('x', 'time')
  .encode('y', 'waiting')
  .encode('color', () => 'waiting')
  .encode('series', () => 'waiting')
  .axis('y', { title: 'Waiting' });

chart
  .interval()
.style('maxWidth', 40)
  .encode('x', 'time')
  .encode('y', 'people')
  .encode('color', () => 'people')
  .encode('series', () => 'people')
  .scale('y', { independent: true })
  .axis('y', { position: 'right', grid: null, title: 'People' });

chart.render();

预期行为

No response

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox]

屏幕截图或视频(可选)

No response

补充说明(可选)

No response


.scale('series', { padding: 0.2 })
posted by pearmini over 1 year ago

Fund this Issue

$0.00
Funded

Pull requests