How to use the @antv/g2plot.StackBar function in @antv/g2plot

To help you get started, we’ve selected a few @antv/g2plot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github antvis / G2Plot / examples / bar / stack / demo / basic.js View on Github external
细分: '消费者',
    销售额: 677302.8919999995,
  },
  {
    地区: '西北',
    细分: '公司',
    销售额: 253458.1840000001,
  },
  {
    地区: '西北',
    细分: '消费者',
    销售额: 458058.1039999998,
  },
];

const stackBarPlot = new StackBar(document.getElementById('container'), {
  forceFit: true,
  title: {
    visible: true,
    text: '百分比堆叠条形图',
  },
  data,
  yField: '地区',
  xField: '销售额',
  xAxis: {
    formatter: (v) => Math.round(v / 10000) + '万',
  },
  stackField: '细分',
});

stackBarPlot.render();
github antvis / G2Plot / examples / bar / stack / demo / adjust-label-display.js View on Github external
细分: '公司',
    销售额: 253458.1840000001,
  },
  {
    地区: '西北',
    细分: '消费者',
    销售额: 458058.1039999998,
  },
  {
    地区: '西北',
    细分: '小型企业',
    销售额: 103523.308,
  },
];

const stackBarPlot = new StackBar(document.getElementById('container'), {
  forceFit: true,
  title: {
    visible: true,
    text: '堆叠条形图:label自动隐藏',
  },
  description: {
    visible: true,
    text:
      '在堆叠条形图中,如果label的位置被设定为middle,即显示在条形中间。在对应形状大小不够摆放label的情况下,label会被自动隐藏。',
  },
  data,
  yField: '地区',
  xField: '销售额',
  xAxis: {
    formatter: (v) => Math.round(v / 10000) + '万',
  },