Pyramid Chart

A pyramid chart displays values as proportional segments in a triangular shape, perfect for showing hierarchical structures and relative proportions. Pyramid charts are typically used for displaying demographic data, market segmentation, organizational structures, or workflows.

Pyramid Chart

Structure

import "@gooddata/sdk-ui-charts/styles/css/main.css";
import { PyramidChart } from "@gooddata/sdk-ui-charts";

<PyramidChart
    measures={<measures>}
    config={<chart-config>}
    
/>

Example

import "@gooddata/sdk-ui-charts/styles/css/main.css";
import { PyramidChart } from "@gooddata/sdk-ui-charts";
import * as Md from "./md/full";

const style = { height: 300 };

<div style={style}>
    <PyramidChart
        measures={[Md.$TotalSales]}
        viewBy={Md.Product.Name}
    />
</div>

Properties

NameRequired?TypeDescription
measurestrueIMeasure[]An array of measure definitions. If you specify single measure, then you can also specify the viewBy attribute. If you specify multiple measures, then those measure values will be charted into a pyramid.
viewByfalseIAttributeThe attribute definition that will be used to slice the single measure into multiple pieces that will be charted into a pyramid.
filtersfalseIFilter[]An array of filter definitions
sortByfalseISortItem[]An array of sort definitions
configfalseIChartConfigThe chart configuration object
backendfalseIAnalyticalBackendThe object with the configuration related to communication with the backend and access to analytical workspaces
workspacefalsestringThe workspace ID
localefalsestringThe localization of the chart. Defaults to en-US.
drillableItemsfalseIDrillableItem[]An array of points and attribute values to be drillable
ErrorComponentfalseComponentA component to be rendered if this component is in error state
LoadingComponentfalseComponentA component to be rendered if this component is in loading state
onErrorfalseFunctionA callback when the component updates its error state
onExportReadyfalseFunctionA callback when the component is ready for exporting its data
onLoadingChangedfalseFunctionA callback when the component updates its loading state
onDrillfalseFunctionA callback when a drill is triggered on the component

Configuration

The following example shows the supported config structure with sample values for pyramid charts.

{
    colors: ["rgb(195, 49, 73)", "rgb(168, 194, 86)"],
    colorPalette: [{
        guid: "01",
        fill: {
            r: 195,
            g: 49,
            b: 73
        }
    }, {
        guid: "02",
        fill: {
            r: 168,
            g: 194,
            b: 86
        }
    }],
    colorMapping: [{
        predicate: (headerItem) => {
            return headerItem.measureHeaderItem && (headerItem.measureHeaderItem.localIdentifier === "m1_localIdentifier")
        },
        color: {
            type: "guid",
            value: "02"
        }
    }],
    legend: {
        enabled: true,
        position: "top",
    },
    dataLabels: {
        visible: "auto"
    },
    separators: {
        thousand: ",",
        decimal: "."
    }
}

Usage Patterns

Single Measure with ViewBy Attribute

When using a single measure with a viewBy attribute, each attribute value creates a segment in the pyramid:

<PyramidChart
    measures={[Md.$Revenue]}
    viewBy={Md.Region}
/>

Multiple Measures

When using multiple measures, each measure creates a segment in the pyramid. The viewBy attribute cannot be used in this case:

<PyramidChart
    measures={[Md.$Revenue, Md.$Profit, Md.$Costs]}
/>

Limits

Pyramid charts work best with a reasonable number of segments (typically 3-10) to maintain readability and visual impact.