Pyramid of levels
Levels from a narrow top to a wide base, with their value and share. Good for customer levels, sales stages, needs.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
const spec = {
type: 'pyramid',
data: [
{ name: 'Buyers', text: 'Paid at least once', value: 40 },
{ name: 'Leads', text: 'Asked for a quote', value: 90 },
{ name: 'Prospects', text: 'Opened an e-mail', value: 180 },
{ name: 'Contacts', text: 'Known by name', value: 810 },
],
};
export default function Example() {
return <Chart spec={spec} style={{ height: 340 }} />;
}Or import this chart alone: what each import weighs.
Options
Beside the fields shared by every chart (title, format, heading, export…), type pyramid takes:
/** Levels from the narrow top to the wide base, each with its value and its share. */
interface PyramidSpec extends Base {
type: 'pyramid';
data: { name: string; value?: number; text?: string; color?: string }[];
/** Height of each level: the same for all (default), or as large as its value. */
heights?: 'equal' | 'value';
}Style it
- Colours:
theme.palette,chart.setColor(name, colour), or--nervure-palettein your CSS. More - Marks:
[data-series="name"], parts:[data-part="axes"],legend,series. What you change is kept in exports. - Movement:
animation: falsedraws at once. More - Files:
chart.download('png'),svg,csv. More