彩条图

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

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

chart.options({
  type: 'area',
  data: {
    type: 'fetch',
    value:
      'https://gw.alipayobjects.com/os/bmw-prod/e58c9758-0a09-4527-aa90-fbf175b45925.json',
  },
  transform: [{ type: 'stackY', orderBy: 'value' }],
  encode: {
    x: (d) => new Date(d.date),
    y: 'unemployed',
    color: 'industry',
    shape: 'smooth',
  },
  scale: { x: { utc: true } },
  axis: { x: { title: 'Date' }, y: { labelFormatter: '~s' } },
  legend: { color: { size: 72, autoWrap: true, maxRows: 3, cols: 6 } },
});

chart.render();
全站搜索
文档与示例输入关键词开始搜索

输入关键词,查找文档、API 与示例

选择打开Esc关闭