---
title: "Pyramid Series"
framework: react
version: "14.1.0"
---

# Pyramid Series

A Pyramid Series is a triangular shaped visualisation that uses the height of each segment to represent its value as a proportion of the whole.

## Simple Pyramid

#### Pyramid Chart

```tsx
import React, { useState } from "react";
import { createRoot } from "react-dom/client";
import { AgCharts } from "ag-charts-react";
import {
  AgChartOptions,
  AnimationModule,
  ContextMenuModule,
  LegendModule,
  ModuleRegistry,
  PyramidSeriesModule,
} from "ag-charts-enterprise";
import { getData } from "./data";

ModuleRegistry.registerModules([
  AnimationModule,
  LegendModule,
  PyramidSeriesModule,
  ContextMenuModule,
]);

const ChartExample = () => {
  const [options, setOptions] = useState<AgChartOptions>({
    data: getData(),
    title: {
      text: "Revenue Open by Sales Stage",
    },
    series: [
      {
        type: "pyramid",
        stageKey: "group",
        valueKey: "value",
      },
    ],
  });

  return <AgCharts options={options} />;
};

const root = createRoot(document.getElementById("root")!);
root.render(<ChartExample />);
```

[Live example: Pyramid Chart](https://www.ag-grid.com/charts/reactFunctionalTs/pyramid-series/examples/simple-pyramid)

To create a Pyramid Series, use the `pyramid` series type.

```js
{
    series: [
        {
            type: 'pyramid',
            stageKey: 'group',
            valueKey: 'value',
        },
    ],
}
```

In this configuration:

- `stageKey` defines the categories, each of which is mapped to segments in the pyramid.
- `valueKey` provides the numerical values, determining the height of each segment.

## Horizontal Pyramid

#### Horizontal Pyramid Chart

```tsx
import React, { useState } from "react";
import { createRoot } from "react-dom/client";
import { AgCharts } from "ag-charts-react";
import {
  AgChartOptions,
  AnimationModule,
  ContextMenuModule,
  ModuleRegistry,
  PyramidSeriesModule,
} from "ag-charts-enterprise";
import { getData } from "./data";

ModuleRegistry.registerModules([
  AnimationModule,
  PyramidSeriesModule,
  ContextMenuModule,
]);

const ChartExample = () => {
  const [options, setOptions] = useState<AgChartOptions>({
    data: getData(),
    title: {
      text: "Revenue Open by Sales Stage",
    },
    seriesArea: {
      padding: {
        left: 20,
        right: 20,
      },
    },
    series: [
      {
        type: "pyramid",
        stageKey: "group",
        valueKey: "value",
        direction: "horizontal",
      },
    ],
  });

  return <AgCharts options={options} />;
};

const root = createRoot(document.getElementById("root")!);
root.render(<ChartExample />);
```

[Live example: Horizontal Pyramid Chart](https://www.ag-grid.com/charts/reactFunctionalTs/pyramid-series/examples/horizontal-pyramid)

To create a horizontal Pyramid Series, set the `direction` to `horizontal`.

```js
{
    direction: 'horizontal',
}
```

## Reverse Pyramid

#### Reverse Pyramid Chart

```tsx
import React, { useState } from "react";
import { createRoot } from "react-dom/client";
import { AgCharts } from "ag-charts-react";
import {
  AgChartOptions,
  AnimationModule,
  ContextMenuModule,
  LegendModule,
  ModuleRegistry,
  PyramidSeriesModule,
} from "ag-charts-enterprise";
import { getData } from "./data";

ModuleRegistry.registerModules([
  AnimationModule,
  LegendModule,
  PyramidSeriesModule,
  ContextMenuModule,
]);

const ChartExample = () => {
  const [options, setOptions] = useState<AgChartOptions>({
    data: getData(),
    title: {
      text: "Revenue Open by Sales Stage",
    },
    seriesArea: {
      padding: {
        left: 20,
        right: 20,
      },
    },
    series: [
      {
        type: "pyramid",
        stageKey: "group",
        valueKey: "value",
        reverse: true,
      },
    ],
  });

  return <AgCharts options={options} />;
};

const root = createRoot(document.getElementById("root")!);
root.render(<ChartExample />);
```

[Live example: Reverse Pyramid Chart](https://www.ag-grid.com/charts/reactFunctionalTs/pyramid-series/examples/reverse-pyramid)

To reverse a Pyramid Series, set `reverse` to `true`.

```js
{
    reverse: true,
}
```

## Customisation

### Fills

#### Pyramid Fills

```tsx
import React, { useState } from "react";
import { createRoot } from "react-dom/client";
import { AgCharts } from "ag-charts-react";
import {
  AgChartOptions,
  AnimationModule,
  ContextMenuModule,
  LegendModule,
  ModuleRegistry,
  PyramidSeriesModule,
} from "ag-charts-enterprise";
import { getData } from "./data";

ModuleRegistry.registerModules([
  AnimationModule,
  LegendModule,
  PyramidSeriesModule,
  ContextMenuModule,
]);

const ChartExample = () => {
  const [options, setOptions] = useState<AgChartOptions>({
    data: getData(),
    title: {
      text: "Revenue Open by Sales Stage",
    },
    seriesArea: {
      padding: {
        left: 20,
        right: 20,
      },
    },
    series: [
      {
        type: "pyramid",
        stageKey: "group",
        valueKey: "value",
        fills: ["#5C6BC0", "#3F51B5", "#303F9F", "#1A237E"],
      },
    ],
  });

  return <AgCharts options={options} />;
};

const root = createRoot(document.getElementById("root")!);
root.render(<ChartExample />);
```

[Live example: Pyramid Fills](https://www.ag-grid.com/charts/reactFunctionalTs/pyramid-series/examples/pyramid-fills)

The colours in a Pyramid Series can be customised with the `fills` property.

```js
{
    fills: ['#5C6BC0', '#3F51B5', '#303F9F', '#1A237E'],
}
```

### Shape

#### Pyramid Aspect Ratio

```tsx
import React, { useState, Fragment } from "react";
import { createRoot } from "react-dom/client";
import { AgCharts } from "ag-charts-react";
import {
  AgPyramidSeriesOptions,
  AgStandaloneChartOptions,
  AnimationModule,
  ContextMenuModule,
  LegendModule,
  ModuleRegistry,
  PyramidSeriesModule,
} from "ag-charts-enterprise";
import { getData } from "./data";
import clone from "clone";

ModuleRegistry.registerModules([
  AnimationModule,
  LegendModule,
  PyramidSeriesModule,
  ContextMenuModule,
]);

const ChartExample = () => {
  const [options, setOptions] = useState<AgStandaloneChartOptions>({
    data: getData(),
    title: {
      text: "Revenue Open by Sales Stage",
    },
    seriesArea: {
      padding: {
        left: 20,
        right: 20,
      },
    },
    series: [
      {
        type: "pyramid",
        stageKey: "group",
        valueKey: "value",
        aspectRatio: 3 / 2,
        label: {
          enabled: false,
        },
      },
    ],
  });

  const setDirection = (direction: "horizontal" | "vertical") => {
    const nextOptions = clone(options);

    (nextOptions.series![0] as AgPyramidSeriesOptions).direction = direction;

    setOptions(nextOptions);
  };

  const setAspectRatio = (aspectRatio: number) => {
    const nextOptions = clone(options);

    (nextOptions.series![0] as AgPyramidSeriesOptions).aspectRatio =
      aspectRatio;

    setOptions(nextOptions);
  };

  return (
    <Fragment>
      <div className="example-controls">
        <div className="controls-row">
          <span>Direction:</span>
          <button onClick={() => setDirection("horizontal")}>Horizontal</button>
          <button
            className="gap-right"
            onClick={() => setDirection("vertical")}
          >
            Vertical
          </button>
          <span>Aspect Ratio:</span>
          <button onClick={() => setAspectRatio(2 / 3)}>2 / 3</button>
          <button onClick={() => setAspectRatio(1.1547)}>Equilateral</button>
          <button onClick={() => setAspectRatio(3 / 2)}>3 / 2</button>
        </div>
      </div>
      <AgCharts options={options} />
    </Fragment>
  );
};

const root = createRoot(document.getElementById("root")!);
root.render(<ChartExample />);
```

[Live example: Pyramid Aspect Ratio](https://www.ag-grid.com/charts/reactFunctionalTs/pyramid-series/examples/pyramid-aspect-ratio)

The shape of the triangle can be set using the `aspectRatio` property.

```js
{
    aspectRatio: 3 / 2,
}
```

In this configuration:

- `aspectRatio` is set such that width will grow `3px` for every `2px` of height.

## API Reference

#### Pyramid Series

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| type (required) | 'pyramid' |  | Configuration for the Pyramid Series. |
| stageKey (required) | DatumKey |  | The key to use to retrieve stage values from the data. |
| valueKey (required) | DatumKey |  | The key to use to retrieve values from the data. |
| id | string | auto-generated value | Primary identifier for the series. This is provided as `seriesId` in user callbacks to differentiate multiple series. Auto-generated ids are subject to future change without warning, if your callbacks need to vary behaviour by series please supply your own unique `id` value. |
| context | ContextDefault |  | Context object to use in callbacks. |
| data | DatumDefault[] |  | The data to use when rendering the series. If this is not supplied, data must be set on the chart instead. |
| visible | boolean |  | Whether to display the series. |
| cursor | string |  | The cursor to use for hovered markers. This config is identical to the CSS `cursor` property. |
| highlight | AgHighlightOptions |  | Configuration for highlighting when a series or legend item is hovered over. |
| highlight.enabled | boolean |  | Set to `false` to disable highlighting. |
| highlight.highlightedItem | AgHighlightStyleOptions |  | Options for the highlighted item. |
| highlight.highlightedItem.opacity | Opacity |  | The opacity of the whole series (line, fill, labels and markers, if any) |
| highlight.highlightedItem.stroke | CssColor \| AgColorRef \| AgColorRefMixOnto \| AgColorRefMixOntoColor |  | The colour for the stroke. |
| highlight.highlightedItem.strokeWidth | PixelSize |  | The width of the stroke in pixels. |
| highlight.highlightedItem.strokeOpacity | Opacity |  | The opacity of the stroke colour. |
| highlight.highlightedItem.lineDash | PixelSize[] |  | An array specifying the length in pixels of alternating dashes and gaps. |
| highlight.highlightedItem.lineDashOffset | PixelSize |  | The initial offset of the dashed line in pixels. |
| highlight.highlightedItem.fill | CssColor \| AgColorRef \| AgColorRefMixOnto \| AgColorRefMixOntoColor \| AgGradientColor \| AgPatternColor \| AgImageFill |  | The colour for filling shapes. A colour string, or an object for a gradient, pattern, or image fill. |
| highlight.highlightedItem.fillOpacity | Opacity |  | The opacity of the fill colour. |
| highlight.unhighlightedItem | AgHighlightStyleOptions |  | Options for the un-highlighted items when there is an active highlight. |
| highlight.unhighlightedItem.opacity | Opacity |  | The opacity of the whole series (line, fill, labels and markers, if any) |
| highlight.unhighlightedItem.stroke | CssColor \| AgColorRef \| AgColorRefMixOnto \| AgColorRefMixOntoColor |  | The colour for the stroke. |
| highlight.unhighlightedItem.strokeWidth | PixelSize |  | The width of the stroke in pixels. |
| highlight.unhighlightedItem.strokeOpacity | Opacity |  | The opacity of the stroke colour. |
| highlight.unhighlightedItem.lineDash | PixelSize[] |  | An array specifying the length in pixels of alternating dashes and gaps. |
| highlight.unhighlightedItem.lineDashOffset | PixelSize |  | The initial offset of the dashed line in pixels. |
| highlight.unhighlightedItem.fill | CssColor \| AgColorRef \| AgColorRefMixOnto \| AgColorRefMixOntoColor \| AgGradientColor \| AgPatternColor \| AgImageFill |  | The colour for filling shapes. A colour string, or an object for a gradient, pattern, or image fill. |
| highlight.unhighlightedItem.fillOpacity | Opacity |  | The opacity of the fill colour. |
| nodeClickRange | PixelSize \| 'exact' \| 'nearest' \| 'area' |  | Range from a node that a click triggers the listener. |
| showInLegend | boolean |  | Whether to include the series in the legend. |
| listeners | AgSeriesListeners |  | A map of event names to event listeners. |
| listeners.seriesNodeClick | Listener |  | The listener to call when a node (marker, column, bar, tile or a pie sector) in the series is clicked. |
| listeners.seriesNodeDoubleClick | Listener |  | The listener to call when a node (marker, column, bar, tile or a pie sector) in the series is double-clicked. |
| fills | Array<CssColor \| AgColorRef \| AgColorRefMixOnto \| AgColorRefMixOntoColor \| AgGradientColor \| AgPatternColor \| AgImageFill> |  | The colours to cycle through for the fills of the stages. An array of colour strings, or fill objects for gradients, patterns, or images. |
| strokes | CssColor[] |  | The colours to cycle through for the strokes of the stages. |
| fillOpacity | Opacity |  | The opacity of the fill for the stages. |
| strokeOpacity | Opacity |  | The opacity of the stroke for the stages. |
| strokeWidth | PixelSize |  | The width in pixels of the stroke for the stages. |
| direction | 'horizontal' \| 'vertical' |  | Stage rendering direction. |
| reverse | boolean |  | Reverse the order of the stages. |
| spacing | number |  | Spacing between the stages. |
| aspectRatio | number |  | Ratio of the triangle width to its height. When unset, the triangle will fill the available space. |
| label | AgPyramidSeriesLabelOptions |  | Configuration for the labels shown on stages. |
| label.formatter | RichFormatter |  | A custom formatting function used to convert data values into text for display by labels. |
| label.format | string |  | Format string used when rendering labels. |
| label.itemStyler | Styler |  | Function used to style individual datum labels. |
| label.enabled | boolean |  | Whether the associated elements and properties should be used in the chart. |
| label.color | CssColor \| AgColorRef \| AgColorRefMixOnto \| AgColorRefMixOntoColor |  | The colour for text elements. A colour string, or a theme-colour reference object. |
| label.fontSize | FontSize |  | The size of the font in pixels for text elements. |
| label.fontFamily | FontFamily |  | The font family for text elements. |
| label.fontStyle | FontStyle |  | The style to use for text elements. |
| label.fontWeight | FontWeight |  | The font weight to use for text elements. |
| label.border | BorderOptions |  | Stroke options for the box border. |
| label.border.enabled | boolean |  | Whether the associated elements and properties should be used in the chart. |
| label.border.stroke | CssColor \| AgColorRef \| AgColorRefMixOnto \| AgColorRefMixOntoColor |  | The colour for the stroke. |
| label.border.strokeWidth | PixelSize |  | The width of the stroke in pixels. |
| label.border.strokeOpacity | Opacity |  | The opacity of the stroke colour. |
| label.cornerRadius | PixelSize |  | Apply rounded corners to the label box. |
| label.padding | PixelSize \| PaddingOptions |  | Distance between the label text and the border. A number applies uniform padding; an object sets each side. |
| label.fill | CssColor \| AgColorRef \| AgColorRefMixOnto \| AgColorRefMixOntoColor \| AgGradientColor \| AgPatternColor \| AgImageFill |  | The colour for filling shapes. A colour string, or an object for a gradient, pattern, or image fill. |
| label.fillOpacity | Opacity |  | The opacity of the fill colour. |
| stageLabel | AgPyramidSeriesStageLabelOptions |  | Configuration for the stage labels. |
| stageLabel.placement | 'before' \| 'after' |  | Placement of the label in relation to the chart. |
| stageLabel.spacing | number |  | Spacing of the label in relation to the chart. |
| stageLabel.formatter | RichFormatter |  | A custom formatting function used to convert data values into text for display by labels. |
| stageLabel.format | string |  | Format string used when rendering labels. |
| stageLabel.itemStyler | Styler |  | Function used to style individual datum labels. |
| stageLabel.enabled | boolean |  | Whether the associated elements and properties should be used in the chart. |
| stageLabel.color | CssColor \| AgColorRef \| AgColorRefMixOnto \| AgColorRefMixOntoColor |  | The colour for text elements. A colour string, or a theme-colour reference object. |
| stageLabel.fontSize | FontSize |  | The size of the font in pixels for text elements. |
| stageLabel.fontFamily | FontFamily |  | The font family for text elements. |
| stageLabel.fontStyle | FontStyle |  | The style to use for text elements. |
| stageLabel.fontWeight | FontWeight |  | The font weight to use for text elements. |
| stageLabel.border | BorderOptions |  | Stroke options for the box border. |
| stageLabel.border.enabled | boolean |  | Whether the associated elements and properties should be used in the chart. |
| stageLabel.border.stroke | CssColor \| AgColorRef \| AgColorRefMixOnto \| AgColorRefMixOntoColor |  | The colour for the stroke. |
| stageLabel.border.strokeWidth | PixelSize |  | The width of the stroke in pixels. |
| stageLabel.border.strokeOpacity | Opacity |  | The opacity of the stroke colour. |
| stageLabel.cornerRadius | PixelSize |  | Apply rounded corners to the label box. |
| stageLabel.padding | PixelSize \| PaddingOptions |  | Distance between the label text and the border. A number applies uniform padding; an object sets each side. |
| stageLabel.fill | CssColor \| AgColorRef \| AgColorRefMixOnto \| AgColorRefMixOntoColor \| AgGradientColor \| AgPatternColor \| AgImageFill |  | The colour for filling shapes. A colour string, or an object for a gradient, pattern, or image fill. |
| stageLabel.fillOpacity | Opacity |  | The opacity of the fill colour. |
| shadow | AgDropShadowOptions |  | Configuration for the shadow used behind the series items. |
| shadow.enabled | boolean |  | Whether the shadow is visible. |
| shadow.color | CssColor |  | The colour of the shadow. |
| shadow.xOffset | PixelSize |  | The horizontal offset in pixels for the shadow. |
| shadow.yOffset | PixelSize |  | The vertical offset in pixels for the shadow. |
| shadow.blur | PixelSize |  | The radius of the shadow's blur, given in pixels. |
| tooltip | AgSeriesTooltip |  | Series-specific tooltip configuration. |
| tooltip.enabled | boolean |  | Whether to show tooltips when the series are hovered over. |
| tooltip.showArrow | boolean |  | The tooltip arrow is displayed by default, unless the container restricts it or a position offset is provided. To always display the arrow, set `showArrow` to `true`. To remove the arrow, set `showArrow` to `false`. |
| tooltip.range | PixelSize \| 'exact' \| 'nearest' \| 'area' |  | Range from a point that triggers the tooltip to show. Each series type uses its own default; typically this is `'nearest'` for marker-based series and `'exact'` for shape-based series. |
| tooltip.position | AgTooltipPositionOptions |  | The position of the tooltip. Each series type uses its own default; typically this is `'node'` for marker-based series and `'pointer'` for shape-based series. |
| tooltip.position.anchorTo | AgTooltipAnchorTo |  | The element or point to position the tooltip relative to. |
| tooltip.position.placement | AgTooltipPlacement \| AgTooltipPlacement[] |  | The positioning of the tooltip in relation to the element it's anchored to. Multiple values can be provided as a fallback mechanism for the case the tooltip does not fit inside the chart. |
| tooltip.position.xOffset | PixelSize |  | The horizontal offset in pixels for the position of the tooltip. |
| tooltip.position.yOffset | PixelSize |  | The vertical offset in pixels for the position of the tooltip. |
| tooltip.position.offset | PixelSize |  | The distance in pixels between the tooltip and its anchor point, applied in the placement direction.  Default: `12` (`0` when `anchorTo` is `'chart'`). |
| tooltip.interaction | AgSeriesTooltipInteraction |  | Configuration for tooltip interaction. |
| tooltip.interaction.enabled (required) | boolean |  | Set to `true` to keep the tooltip open when the mouse is hovering over it, and enable clicking tooltip text |
| tooltip.renderer | Renderer |  | Function used to create the content for tooltips. |
| itemStyler | Styler |  | Function used to return formatting for individual bars, based on the given parameters. |
| lineDash | PixelSize[] |  | An array specifying the length in pixels of alternating dashes and gaps. |
| lineDashOffset | PixelSize |  | The initial offset of the dashed line in pixels. |
