Pyramid.
COMMUNITYRepresent stage sizes as a pyramid.
LIVE EXAMPLE
Hierarchy magnitude
Appearance and style8
Legend and interaction11
Title and dimensions3
Show stage magnitudes from a narrow top to a wide bottom. All values are sample data.
View code
<div id="chart-container" style="width: 100%; min-width: 0;"></div>
<script type="module">
import { defineCustomElement as define0 } from '@syidax/advanced/components/sy-funnel-chart.js';
define0();
const specs = [
{
"id": "example-chart",
"tag": "sy-funnel-chart",
"props": {
"engine": "standard",
"reversed": true,
"neckWidth": 0,
"neckHeight": 0,
"data": [
{
"name": "Opening",
"value": 60
},
{
"name": "Growth",
"value": 30
},
{
"name": "Expert",
"value": 10
}
],
"colors": ["#8263d9", "#239c91", "#e99954", "#d76c8f", "#4d89c4", "#95a551"],
"width": 640,
"height": 360,
"brandPosition": "bottom-right",
"brandLogo": ""
}
}
];
const container = document.querySelector('#chart-container');
const elements = specs.map(({ tag, id, props }) => {
const element = document.createElement(tag);
element.id = id;
Object.assign(element, props);
element.setAttribute('aria-label', 'pyramid example chart');
return element;
});
container.replaceChildren(...elements);
const chart = elements.at(-1);
const onEvent = event => {
console.log('sectionClick', event.detail);
};
chart.addEventListener('sectionClick', onEvent);
const observer = new ResizeObserver(([entry]) => {
const width = Math.max(160, Math.floor(entry.contentRect.width));
elements.forEach(element => { element.width = width; });
});
observer.observe(container);
// In an SPA, call this function when the view is disposed.
function disposeChart() {
observer.disconnect();
chart.removeEventListener('sectionClick', onEvent);
container.replaceChildren();
}
</script>Usage and data
#Use to explain layered structures such as foundation, growth, and expertise.
A pyramid uses Funnel's reversed and neck settings. Provide a table for precise size comparisons.
Data contract
| Property | Input format |
|---|---|
data | An array of { name, value }, starting with the widest layer. |
reversed | Set true to form a pyramid. |
neckWidth | Set to 0. |
neckHeight | Set to 0. |
Updating data
Assign a new array or object to the property instead of mutating values inside an array. Chart events provide selection results through event.detail. When disposing of the view, clean up ResizeObserver and event listeners registered by your app.
Feature examples
#Try 20 interactive feature examples and inspect their code. Select “Edit in preview” to combine more options in the settings panel above.
Stage spacing
Adjust spacing between stages of the inverted funnel.
View code
Stage proportions
Show each stage's proportion and actual value together.
View code
Inspect values with the pointer
Point to data to view the value at that location.
View code
Replay animation
Redraw the same example to inspect its initial display animation.
View code
Animation
Compare 4 examples of Animation. Buttons and options update both the live result and source code.
View code
Color
Compare 2 examples of Color. Buttons and options update both the live result and source code.
View code
Label
Compare 4 examples of Label. Buttons and options update both the live result and source code.
View code
Legend
Compare 3 examples of Legend. Buttons and options update both the live result and source code.
View code
Highlight state
Compare 4 examples of Highlight state. Buttons and options update both the live result and source code.
View code
Pyramid
Compare 4 examples of Pyramid. Buttons and options update both the live result and source code.
View code
Section Styles
Compare 1 examples of Section Styles. Buttons and options update both the live result and source code.
View code
Shape
Compare 3 examples of Shape. Buttons and options update both the live result and source code.
View code
Tooltip
Compare 11 examples of Tooltip. Buttons and options update both the live result and source code.
View code
Context menu
Compare 1 examples of Context menu. Buttons and options update both the live result and source code.
View code
Data context menu
Compare 1 examples of Data context menu. Buttons and options update both the live result and source code.
View code
Section Events
Compare 1 examples of Section Events. Buttons and options update both the live result and source code.
View code
Read coordinates and data
Compare 1 examples of Read coordinates and data. Buttons and options update both the live result and source code.
View code
Runtime API
Compare 1 examples of Runtime API. Buttons and options update both the live result and source code.
View code
Overview
Compare 1 examples of Overview. Buttons and options update both the live result and source code.
View code
Streaming · Add and update live dataPRO
Compare 3 examples of Add and update live data. Buttons and options update both the live result and source code.
View code
Add to your interface
#The code tabs below the preview contain the full data, options, event bindings, and responsive sizing for the current example. Copy them into an app project, such as Vite, that can resolve the installed packages.
API reference
#The full public API for sy-funnel-chart. Pass objects and arrays as JavaScript properties. Select a name to view usage code and type definitions.
Key properties
| Attribute / Property | Type / Default | Description |
|---|---|---|
FunnelChartDataDefault: [] | An array of { name, value }, starting with the widest layer. | |
numberDefault: 420 | Chart width in pixels. Update with ResizeObserver when the container changes. | |
numberDefault: 360 | Chart height in pixels. | |
| brandLogo | stringDefault: undefined | The default is the Syidax logo. With the Pro chart.branding entitlement, use none or a PNG, JPEG, or WebP data URL. |
| brandPosition | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'Default: 'bottom-right' | The corner where the logo is anchored. Applies equally to Community and Pro, on screen and in image exports. |
booleanDefault: false | Set true to form a pyramid. | |
| neckWidth | numberDefault: 0.3 | Set to 0. |
| neckHeight | numberDefault: 0.25 | Set to 0. |
numberDefault: 2 | Vertical gap between sections (px). | |
| labelPlacement | FunnelLabelPlacementDefault: 'inside' | Allowed values: none, left, right, inside. Default: 'inside'. |
| labelFontSize | numberDefault: 12 | Set as an HTML attribute or JavaScript property. type: number. |
| showValue | booleanDefault: true | Set as an HTML attribute or JavaScript property. type: boolean. |
| showPercent | booleanDefault: false | Set as an HTML attribute or JavaScript property. type: boolean. |
| chartTitle | stringDefault: undefined | The title inside the chart. Explain the data's unit and meaning alongside it. |
| chartSubtitle | stringDefault: undefined | The subtitle inside the chart. |
| tooltipShow | booleanDefault: true | Whether to display the built-in tooltip. |
FunnelChartTooltipInputDefault: undefined | Tooltip settings for pointer-driven values, position, and content. | |
booleanDefault: false | Whether to show a legend for series or items. | |
| legendPosition | FunnelChartLegendPositionDefault: 'bottom' | Where the legend is positioned. |
| animated | booleanDefault: false | Whether to animate initial display and data changes. |
| animationDuration | numberDefault: 700 | Animation duration in milliseconds. |
| animationEasing | FunnelChartEasingDefault: 'ease-out' | Allowed values: linear, ease-out, ease-in, ease-in-out. Default: 'ease-out'. |
| animationType | FunnelChartAnimationTypeDefault: undefined | Allowed values: initial, update. Default: undefined. |
Other properties 18
| Attribute / Property | Type / Default | Description |
|---|---|---|
stringDefault: '#2563eb' | Set as an HTML attribute or JavaScript property. type: string. | |
ReadonlyArray<string>Default: undefined | Per-section palette. Per-section `color` always wins. | |
| labelColor | stringDefault: '#374151' | Set as an HTML attribute or JavaScript property. type: string. |
| insideLabelColor | stringDefault: '#ffffff' | Set as an HTML attribute or JavaScript property. type: string. |
| valueFormat | stringDefault: undefined | Set as an HTML attribute or JavaScript property. type: string. |
| leaderColor | stringDefault: '#cbd5e1' | Set as an HTML attribute or JavaScript property. type: string. |
| tooltipFormat | (detail: FunnelChartPointerEventDetail) => stringDefault: undefined | Pass as a JavaScript property. type: (detail: FunnelChartPointerEventDetail) => string. |
| enableMouseTracking | booleanDefault: true | Set as an HTML attribute or JavaScript property. type: boolean. |
| inactiveOtherSections | booleanDefault: false | Set as an HTML attribute or JavaScript property. type: boolean. |
| inactiveSectionOpacity | numberDefault: 0.3 | Set as an HTML attribute or JavaScript property. type: number. |
| activeSectionIndex | numberDefault: undefined | Set as an HTML attribute or JavaScript property. type: number. |
| legendItems | LegendItem[]Default: undefined | Pass as a JavaScript property. type: LegendItem[]. |
| streamSource | FunnelChartStreamSourceDefault: undefined | A stream source for live data. Check the contract for the specific type. |
| streamWindow | numberDefault: undefined | The streaming data range to keep visible. |
| streamMax | numberDefault: undefined | The maximum number of streaming data points to retain. |
FunnelChartEngineModeDefault: 'auto' | Renderer selection: auto, standard, or pro. Engine selection is separate from permission to use a Pro chart type. | |
| proThreshold | numberDefault: 50_000 | Set as an HTML attribute or JavaScript property. type: number. |
FunnelChartUnavailableBehaviourDefault: 'fallback' | Allowed values: fallback, error, throw. Default: 'fallback'. |
Events 14
| Events | Detail type | Description |
|---|---|---|
FunnelChartRenderResult & { tier: FunnelChartEngineTier } | Emits rendering results in detail when chart drawing completes. | |
FunnelChartPointerEventDetail | CustomEvent.detail type: FunnelChartPointerEventDetail. Event names are case-sensitive. | |
FunnelChartPointerEventDetail | null | CustomEvent.detail type: FunnelChartPointerEventDetail | null. Event names are case-sensitive. | |
ChartPointContextMenuEventDetail<FunnelChartPointerEventDetail> | CustomEvent.detail type: ChartPointContextMenuEventDetail<FunnelChartPointerEventDetail>. Event names are case-sensitive. | |
FunnelChartTooltipShowEventDetail | Whether to display the built-in tooltip. | |
void | CustomEvent.detail type: void. Event names are case-sensitive. | |
FunnelChartTooltipActionEventDetail | CustomEvent.detail type: FunnelChartTooltipActionEventDetail. Event names are case-sensitive. | |
{ index: number; sectionId: string; label: string; disabled: boolean } | CustomEvent.detail type: { index: number; sectionId: string; label: string; disabled: boolean }. Event names are case-sensitive. | |
{ index: number; sectionId: string; disabled: boolean } | CustomEvent.detail type: { index: number; sectionId: string; disabled: boolean }. Event names are case-sensitive. | |
{ count: number } | CustomEvent.detail type: { count: number }. Event names are case-sensitive. | |
{ dropped: number } | CustomEvent.detail type: { dropped: number }. Event names are case-sensitive. | |
void | CustomEvent.detail type: void. Event names are case-sensitive. | |
void | CustomEvent.detail type: void. Event names are case-sensitive. | |
void | CustomEvent.detail type: void. Event names are case-sensitive. |
Methods 19
Stencil methods return Promises. Use await within an async function to read the result.
| Method / Arguments | Return type | Description |
|---|---|---|
Promise<FunnelChartRenderResult> | An asynchronous method. Check the argument and return types below. | |
Promise<FunnelChartEngineTier> | An asynchronous method. Check the argument and return types below. | |
| data: FunnelChartData | Promise<void> | An asynchronous method. Check the argument and return types below. |
| section: FunnelSectionSpec | number, opts?: { insertAt?: number } | Promise<number> | An asynchronous method. Check the argument and return types below. |
| idOrIndex: string | number | Promise<boolean> | An asynchronous method. Check the argument and return types below. |
| idOrIndex: string | number, patch: Partial<FunnelSectionSpec> | Promise<boolean> | An asynchronous method. Check the argument and return types below. |
| section: FunnelSectionSpec | number | Promise<void> | Append a streaming SECTION. Without a stream source, appends to `data`. |
| sections: ReadonlyArray<FunnelSectionSpec | number> | Promise<void> | An asynchronous method. Check the argument and return types below. |
| count?: number | Promise<void> | An asynchronous method. Check the argument and return types below. |
| sections: ReadonlyArray<FunnelSectionSpec | number> | Promise<void> | An asynchronous method. Check the argument and return types below. |
Promise<FunnelChartStreamSource | undefined> | An asynchronous method. Check the argument and return types below. | |
| options: { duration?: number; easing?: FunnelChartEasing; enabled?: boolean; type?: FunnelChartAnimationType } | Promise<void> | An asynchronous method. Check the argument and return types below. |
Promise<void> | An asynchronous method. Check the argument and return types below. | |
Promise<void> | An asynchronous method. Check the argument and return types below. | |
Promise<void> | An asynchronous method. Check the argument and return types below. | |
| cssX: number, cssY: number | Promise<FunnelChartPointerEventDetail | null> | An asynchronous method. Check the argument and return types below. |
| idOrIndex: string | number | Promise<FunnelChartPointerEventDetail | null> | An asynchronous method. Check the argument and return types below. |
Promise<void> | An asynchronous method. Check the argument and return types below. | |
Promise<ChartEngineStatus> | Requested engine vs what runs, and why (CHART-ADD-08): always Standard (this type has no WebGPU renderer); read without side effects, never consults the license. |
No matching APIs.