Skip to content

spaceLayer

Does not divide space in any way, multiple views use the same spatial area, commonly used for view layering.

Getting Started

Draw a common combined bar and pie chart.

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

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

chart.options({
  type: 'spaceLayer',
  data: {
    type: 'fetch',
    value:
      'https://gw.alipayobjects.com/os/bmw-prod/fb9db6b7-23a5-4c23-bbef-c54a55fee580.csv',
    format: 'csv',
  },
  children: [
    // Bar chart
    {
      type: 'interval',
      paddingLeft: 50,
      transform: [{ type: 'sortX', reverse: true, by: 'y' }],
      encode: { x: 'letter', y: 'frequency', color: 'letter' },
    },
    // Pie chart
    {
      type: 'interval',
      paddingLeft: 400,
      paddingBottom: 200,
      coordinate: { type: 'theta' },
      transform: [{ type: 'stackY' }],
      legend: false,
      encode: { y: 'frequency', color: 'letter' },
    },
  ],
});

chart.render();

For more examples, visit the Chart Examples page.

Options

No additional configuration options.

© Copyright 2026 Ant Group Co., Ltd..备案号:京ICP备15032932号-38
Site search
Documentation and examplesType to start searching

Search documentation, APIs, and examples

↑↓Select↵OpenEscClose