Vue ChartsPyramid Series

Version 14.2.0

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 Copy Link

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

{
    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 Copy Link

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

{
    direction: 'horizontal',
}

Reverse Pyramid Copy Link

To reverse a Pyramid Series, set reverse to true.

{
    reverse: true,
}

Customisation Copy Link

Fills Copy Link

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

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

Shape Copy Link

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

{
    aspectRatio: 3 / 2,
}

In this configuration:

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

Labels Copy Link

The values can be displayed inside or outside each segment using the label option, and the segment name can be shown with the stageLabel option.

{
    label: {
        enabled: true,
        placement: 'inside-center',
    },
    stageLabel: {
        placement: 'before',
    },
}

In this configuration:

  • The label is positioned as inside-center. Use the dropdown to see all available placements.
    • start and end are above and below the segment when vertical, left and right of it when horizontal.
    • before and after are the other two sides, matching stageLabel.placement.
  • stageLabel.placement positions the segment names on either side of the chart.
  • On a vertical pyramid, before and after are mirrored when RTL Layout is enabled.
  • Providing placement as an ordered array (e.g. ['inside-center', 'outside-end']) lets a label that does not fit inside its segment fall back to an outside position.

See Series Labels for the full set of label placement and collision avoidance options, and the API Reference for additional customisation options.

Pyramid Chart Examples Copy Link

See more Pyramid Chart examples in the AG Charts Gallery.

API Reference Copy Link

Properties available on the AgPyramidSeriesOptions interface.

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 default: 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.
nodeClickRange InteractionRange
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.
fills AgColorType[]
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.
stageLabel AgPyramidSeriesStageLabelOptions
Configuration for the stage labels.
shadow AgDropShadowOptions
Configuration for the shadow used behind the series items.
tooltip AgSeriesTooltip
Series-specific tooltip configuration.
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.