---
title: "pyramid-forward"
language: "en"
canonical: "https://g2.antv.antgroup.com/en/examples/general/funnel/pyramid-forward/"
version: "5.4.8"
---

# pyramid-forward

[Live example](https://g2.antv.antgroup.com/en/examples/general/funnel/pyramid-forward/)

[Resource index](/llms.txt)

Provide a DOM element with `id="container"`. The original example source follows.

## Source

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

const data = [
  { text: '顶层', value: 5 },
  { text: '中上层', value: 10 },
  { text: '中等', value: 20 },
  { text: '中下层', value: 25 },
  { text: '底层', value: 40 },
];

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

chart.options({
  type: 'interval',
  coordinate: {
    transform: [{ type: 'transpose' }],
  },
  data: data,
  encode: { x: 'text', y: 'value', color: 'text', shape: 'pyramid' },
  transform: [{ type: 'symmetryY' }],
  scale: {
    x: { paddingOuter: 0, paddingInner: 0 },
    color: { type: 'ordinal' },
  },
  labels: [
    {
      text: (d) => d.text,
      position: 'inside',
    },
    {
      text: (d) => d.value + '%',
      position: 'inside',
      style: { dy: 15 },
    },
  ],
  style: { reverse: true },
  axis: false,
});

chart.render();
```
