sy-funnel-chart

Pyramid

Represent stage sizes as a pyramid.

sy-funnel-chart

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.

Base chart tier: Community. Features such as additional renderers and custom branding have separate entitlement requirements.

InputData description
dataAn array of { name, value }, starting with the widest layer.
reversedSet true to form a pyramid.
neckWidthSet to 0.
neckHeightSet to 0.

Complete implementation example

html
<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>

Properties

data

An array of { name, value }, starting with the widest layer.

ItemValue
JavaScript propertydata
HTML attributePass objects, arrays, and callbacks as JavaScript properties
TypeFunnelChartData
Default[]

width

Chart width in pixels. If the container width changes, update width from a ResizeObserver.

ItemValue
JavaScript propertywidth
HTML attributewidth
Typenumber
Default420

height

Chart height in pixels. Allow space for axes, titles, and the legend.

ItemValue
JavaScript propertyheight
HTML attributeheight
Typenumber
Default360

brandPosition

The corner where the logo is anchored. Community and Pro both support all four corners, using the same position on screen and in image exports.

ItemValue
JavaScript propertybrandPosition
HTML attributebrand-position
Type'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
Default'bottom-right'
Allowed valuestop-left, top-right, bottom-left, bottom-right

reversed

Set true to form a pyramid.

ItemValue
JavaScript propertyreversed
HTML attributereversed
Typeboolean
Defaultfalse

neckWidth

Set to 0.

ItemValue
JavaScript propertyneckWidth
HTML attributeneck-width
Typenumber
Default0.3

neckHeight

Set to 0.

ItemValue
JavaScript propertyneckHeight
HTML attributeneck-height
Typenumber
Default0.25

gap

Vertical gap between sections (px).

ItemValue
JavaScript propertygap
HTML attributegap
Typenumber
Default2

color

Set as an HTML attribute or JavaScript property. type: string.

ItemValue
JavaScript propertycolor
HTML attributecolor
Typestring
Default'#2563eb'

colors

Per-section palette. Per-section color always wins.

ItemValue
JavaScript propertycolors
HTML attributePass objects, arrays, and callbacks as JavaScript properties
TypeReadonlyArray<string>
Defaultundefined

undefined means this property was not explicitly set. The effective value may depend on the chart type and other settings.

labelPlacement

Allowed values: none, left, right, inside. Default: 'inside'.

ItemValue
JavaScript propertylabelPlacement
HTML attributelabel-placement
TypeFunnelLabelPlacement
Default'inside'
Allowed valuesnone, left, right, inside

labelColor

Set as an HTML attribute or JavaScript property. type: string.

ItemValue
JavaScript propertylabelColor
HTML attributelabel-color
Typestring
Default'#374151'

insideLabelColor

Set as an HTML attribute or JavaScript property. type: string.

ItemValue
JavaScript propertyinsideLabelColor
HTML attributeinside-label-color
Typestring
Default'#ffffff'

labelFontSize

Set as an HTML attribute or JavaScript property. type: number.

ItemValue
JavaScript propertylabelFontSize
HTML attributelabel-font-size
Typenumber
Default12

showValue

Set as an HTML attribute or JavaScript property. type: boolean.

ItemValue
JavaScript propertyshowValue
HTML attributeshow-value
Typeboolean
Defaulttrue

showPercent

Set as an HTML attribute or JavaScript property. type: boolean.

ItemValue
JavaScript propertyshowPercent
HTML attributeshow-percent
Typeboolean
Defaultfalse

valueFormat

Set as an HTML attribute or JavaScript property. type: string.

ItemValue
JavaScript propertyvalueFormat
HTML attributevalue-format
Typestring
Defaultundefined

undefined means this property was not explicitly set. The effective value may depend on the chart type and other settings.

leaderColor

Set as an HTML attribute or JavaScript property. type: string.

ItemValue
JavaScript propertyleaderColor
HTML attributeleader-color
Typestring
Default'#cbd5e1'

chartTitle

The title inside the chart. Explain the data's unit and meaning alongside it.

ItemValue
JavaScript propertychartTitle
HTML attributechart-title
Typestring
Defaultundefined

undefined means this property was not explicitly set. The effective value may depend on the chart type and other settings.

chartSubtitle

The subtitle inside the chart.

ItemValue
JavaScript propertychartSubtitle
HTML attributechart-subtitle
Typestring
Defaultundefined

undefined means this property was not explicitly set. The effective value may depend on the chart type and other settings.

tooltipShow

Whether to display the built-in tooltip.

ItemValue
JavaScript propertytooltipShow
HTML attributetooltip-show
Typeboolean
Defaulttrue

tooltipFormat

Pass as a JavaScript property. type: (detail: FunnelChartPointerEventDetail) => string.

ItemValue
JavaScript propertytooltipFormat
HTML attributePass objects, arrays, and callbacks as JavaScript properties
Type(detail: FunnelChartPointerEventDetail) => string
Defaultundefined

undefined means this property was not explicitly set. The effective value may depend on the chart type and other settings.

tooltip

Tooltip settings for pointer-driven values, position, and content.

ItemValue
JavaScript propertytooltip
HTML attributePass objects, arrays, and callbacks as JavaScript properties
TypeFunnelChartTooltipInput
Defaultundefined
Literals in the typeauto, off

undefined means this property was not explicitly set. The effective value may depend on the chart type and other settings.

enableMouseTracking

Set as an HTML attribute or JavaScript property. type: boolean.

ItemValue
JavaScript propertyenableMouseTracking
HTML attributeenable-mouse-tracking
Typeboolean
Defaulttrue

inactiveOtherSections

Set as an HTML attribute or JavaScript property. type: boolean.

ItemValue
JavaScript propertyinactiveOtherSections
HTML attributeinactive-other-sections
Typeboolean
Defaultfalse

inactiveSectionOpacity

Set as an HTML attribute or JavaScript property. type: number.

ItemValue
JavaScript propertyinactiveSectionOpacity
HTML attributeinactive-section-opacity
Typenumber
Default0.3

activeSectionIndex

Set as an HTML attribute or JavaScript property. type: number.

ItemValue
JavaScript propertyactiveSectionIndex
HTML attributeactive-section-index
Typenumber
Defaultundefined

undefined means this property was not explicitly set. The effective value may depend on the chart type and other settings.

legend

Whether to show a legend for series or items.

ItemValue
JavaScript propertylegend
HTML attributelegend
Typeboolean
Defaultfalse

legendPosition

Where the legend is positioned.

ItemValue
JavaScript propertylegendPosition
HTML attributelegend-position
TypeFunnelChartLegendPosition
Default'bottom'
Allowed valuestop, bottom, left, right

legendItems

Pass as a JavaScript property. type: LegendItem[].

ItemValue
JavaScript propertylegendItems
HTML attributePass objects, arrays, and callbacks as JavaScript properties
TypeLegendItem[]
Defaultundefined

undefined means this property was not explicitly set. The effective value may depend on the chart type and other settings.

animated

Whether to animate initial display and data changes.

ItemValue
JavaScript propertyanimated
HTML attributeanimate
Typeboolean
Defaultfalse

animationDuration

Animation duration in milliseconds.

ItemValue
JavaScript propertyanimationDuration
HTML attributeanimation-duration
Typenumber
Default700

animationEasing

Allowed values: linear, ease-out, ease-in, ease-in-out. Default: 'ease-out'.

ItemValue
JavaScript propertyanimationEasing
HTML attributeanimation-easing
TypeFunnelChartEasing
Default'ease-out'
Allowed valueslinear, ease-out, ease-in, ease-in-out

animationType

Allowed values: initial, update. Default: undefined.

ItemValue
JavaScript propertyanimationType
HTML attributeanimation-type
TypeFunnelChartAnimationType
Defaultundefined
Allowed valuesinitial, update

undefined means this property was not explicitly set. The effective value may depend on the chart type and other settings.

streamSource

A stream source for live data. Check the contract for the specific type.

ItemValue
JavaScript propertystreamSource
HTML attributePass objects, arrays, and callbacks as JavaScript properties
TypeFunnelChartStreamSource
Defaultundefined

undefined means this property was not explicitly set. The effective value may depend on the chart type and other settings.

streamWindow

The streaming data range to keep visible.

ItemValue
JavaScript propertystreamWindow
HTML attributestream-window
Typenumber
Defaultundefined

undefined means this property was not explicitly set. The effective value may depend on the chart type and other settings.

streamMax

The maximum number of streaming data points to retain.

ItemValue
JavaScript propertystreamMax
HTML attributestream-max
Typenumber
Defaultundefined

undefined means this property was not explicitly set. The effective value may depend on the chart type and other settings.

engine

Renderer selection: auto, standard, or pro. Engine selection is separate from permission to use a Pro chart type.

ItemValue
JavaScript propertyengine
HTML attributeengine
TypeFunnelChartEngineMode
Default'auto'
Allowed valuesauto, standard, pro

proThreshold

Set as an HTML attribute or JavaScript property. type: number.

ItemValue
JavaScript propertyproThreshold
HTML attributepro-threshold
Typenumber
Default50_000

unavailable

Allowed values: fallback, error, throw. Default: 'fallback'.

ItemValue
JavaScript propertyunavailable
HTML attributeunavailable
TypeFunnelChartUnavailableBehaviour
Default'fallback'
Allowed valuesfallback, error, throw

Events

rendered

Emits rendering results in detail when chart drawing completes.

Event name: rendered. Names are case-sensitive. Read the payload from detail on CustomEvent<FunnelChartRenderResult & { tier: FunnelChartEngineTier }>.

javascript
chart.addEventListener('rendered', event => {
  console.log(event.detail); // FunnelChartRenderResult & { tier: FunnelChartEngineTier }
});

sectionClick

CustomEvent.detail type: FunnelChartPointerEventDetail. Event names are case-sensitive.

Event name: sectionClick. Names are case-sensitive. Read the payload from detail on CustomEvent<FunnelChartPointerEventDetail>.

javascript
chart.addEventListener('sectionClick', event => {
  console.log(event.detail); // FunnelChartPointerEventDetail
});

sectionHover

CustomEvent.detail type: FunnelChartPointerEventDetail | null. Event names are case-sensitive.

Event name: sectionHover. Names are case-sensitive. Read the payload from detail on CustomEvent<FunnelChartPointerEventDetail | null>.

javascript
chart.addEventListener('sectionHover', event => {
  console.log(event.detail); // FunnelChartPointerEventDetail | null
});

pointContextMenu

CustomEvent.detail type: ChartPointContextMenuEventDetail<FunnelChartPointerEventDetail>. Event names are case-sensitive.

Event name: pointContextMenu. Names are case-sensitive. Read the payload from detail on CustomEvent<ChartPointContextMenuEventDetail<FunnelChartPointerEventDetail>>.

javascript
chart.addEventListener('pointContextMenu', event => {
  console.log(event.detail); // ChartPointContextMenuEventDetail<FunnelChartPointerEventDetail>
});

tooltipShow

Whether to display the built-in tooltip.

Event name: tooltipShow. Names are case-sensitive. Read the payload from detail on CustomEvent<FunnelChartTooltipShowEventDetail>.

javascript
chart.addEventListener('tooltipShow', event => {
  console.log(event.detail); // FunnelChartTooltipShowEventDetail
});

tooltipHide

CustomEvent.detail type: void. Event names are case-sensitive.

Event name: tooltipHide. Names are case-sensitive. Read the payload from detail on CustomEvent<void>.

javascript
chart.addEventListener('tooltipHide', event => {
  console.log(event.detail); // void
});

tooltipAction

CustomEvent.detail type: FunnelChartTooltipActionEventDetail. Event names are case-sensitive.

Event name: tooltipAction. Names are case-sensitive. Read the payload from detail on CustomEvent<FunnelChartTooltipActionEventDetail>.

javascript
chart.addEventListener('tooltipAction', event => {
  console.log(event.detail); // FunnelChartTooltipActionEventDetail
});

legendItemClick

CustomEvent.detail type: { index: number; sectionId: string; label: string; disabled: boolean }. Event names are case-sensitive.

Event name: legendItemClick. Names are case-sensitive. Read the payload from detail on CustomEvent<{ index: number; sectionId: string; label: string; disabled: boolean }>.

javascript
chart.addEventListener('legendItemClick', event => {
  console.log(event.detail); // { index: number; sectionId: string; label: string; disabled: boolean }
});

sectionToggled

CustomEvent.detail type: { index: number; sectionId: string; disabled: boolean }. Event names are case-sensitive.

Event name: sectionToggled. Names are case-sensitive. Read the payload from detail on CustomEvent<{ index: number; sectionId: string; disabled: boolean }>.

javascript
chart.addEventListener('sectionToggled', event => {
  console.log(event.detail); // { index: number; sectionId: string; disabled: boolean }
});

appended

CustomEvent.detail type: { count: number }. Event names are case-sensitive.

Event name: appended. Names are case-sensitive. Read the payload from detail on CustomEvent<{ count: number }>.

javascript
chart.addEventListener('appended', event => {
  console.log(event.detail); // { count: number }
});

windowSlid

CustomEvent.detail type: { dropped: number }. Event names are case-sensitive.

Event name: windowSlid. Names are case-sensitive. Read the payload from detail on CustomEvent<{ dropped: number }>.

javascript
chart.addEventListener('windowSlid', event => {
  console.log(event.detail); // { dropped: number }
});

chartAnimationStart

CustomEvent.detail type: void. Event names are case-sensitive.

Event name: chartAnimationStart. Names are case-sensitive. Read the payload from detail on CustomEvent<void>.

javascript
chart.addEventListener('chartAnimationStart', event => {
  console.log(event.detail); // void
});

chartAnimationEnd

CustomEvent.detail type: void. Event names are case-sensitive.

Event name: chartAnimationEnd. Names are case-sensitive. Read the payload from detail on CustomEvent<void>.

javascript
chart.addEventListener('chartAnimationEnd', event => {
  console.log(event.detail); // void
});

chartAnimationInterrupted

CustomEvent.detail type: void. Event names are case-sensitive.

Event name: chartAnimationInterrupted. Names are case-sensitive. Read the payload from detail on CustomEvent<void>.

javascript
chart.addEventListener('chartAnimationInterrupted', event => {
  console.log(event.detail); // void
});

Methods

redraw

Redraw the chart using its current data and options. Inspect the rendered result after the returned Promise resolves.

typescript
redraw(): Promise<FunnelChartRenderResult>

Return type: Promise<FunnelChartRenderResult>. Call the method after element registration and await its Promise result.

getActiveTier

An asynchronous method. Check the argument and return types below.

typescript
getActiveTier(): Promise<FunnelChartEngineTier>

Return type: Promise<FunnelChartEngineTier>. Call the method after element registration and await its Promise result.

setData

Replace the bar set.

typescript
setData(data: FunnelChartData): Promise<void>
ArgumentsTypeRequired
dataFunnelChartDataRequired

Return type: Promise<void>. Call the method after element registration and await its Promise result.

addSection

Funnel / pyramid-only — add a section (stage). Returns its index.

typescript
addSection(section: FunnelSectionSpec | number, opts?: { insertAt?: number }): Promise<number>
ArgumentsTypeRequired
sectionFunnelSectionSpec | numberRequired
opts{ insertAt?: number }Optional

Return type: Promise<number>. Call the method after element registration and await its Promise result.

removeSection

Funnel / pyramid-only — remove a section by id or index.

typescript
removeSection(idOrIndex: string | number): Promise<boolean>
ArgumentsTypeRequired
idOrIndexstring | numberRequired

Return type: Promise<boolean>. Call the method after element registration and await its Promise result.

updateSection

Funnel / pyramid-only — patch a section.

typescript
updateSection(idOrIndex: string | number, patch: Partial<FunnelSectionSpec>): Promise<boolean>
ArgumentsTypeRequired
idOrIndexstring | numberRequired
patchPartial<FunnelSectionSpec>Required

Return type: Promise<boolean>. Call the method after element registration and await its Promise result.

appendPoint

Append one value to the stream. Check the argument type and the licensing requirements for streaming.

typescript
appendPoint(section: FunnelSectionSpec | number): Promise<void>
ArgumentsTypeRequired
sectionFunnelSectionSpec | numberRequired

Return type: Promise<void>. Call the method after element registration and await its Promise result.

appendBatch

Append multiple values to the stream. Check the argument type and the licensing requirements for streaming.

typescript
appendBatch(sections: ReadonlyArray<FunnelSectionSpec | number>): Promise<void>
ArgumentsTypeRequired
sectionsReadonlyArray<FunnelSectionSpec | number>Required

Return type: Promise<void>. Call the method after element registration and await its Promise result.

shift

Drop the oldest streamed categories (the data boxes are not the stream).

typescript
shift(count?: number): Promise<void>
ArgumentsTypeRequired
countnumberOptional

Return type: Promise<void>. Call the method after element registration and await its Promise result.

replace

Swap the streamed set (replace([]) clears it); the base values never leave. Without chart.streaming the dies upsert into the base like a batch (quietly: no appended, no binChanged, as a ring replace).

typescript
replace(sections: ReadonlyArray<FunnelSectionSpec | number>): Promise<void>
ArgumentsTypeRequired
sectionsReadonlyArray<FunnelSectionSpec | number>Required

Return type: Promise<void>. Call the method after element registration and await its Promise result.

getStreamSource

The stream session's source (Chart Pro): like the stream methods it waits for a license still being confirmed.

typescript
getStreamSource(): Promise<FunnelChartStreamSource | undefined>

Return type: Promise<FunnelChartStreamSource | undefined>. Call the method after element registration and await its Promise result.

setAnimation

An asynchronous method. Check the argument and return types below.

typescript
setAnimation(options: { duration?: number; easing?: FunnelChartEasing; enabled?: boolean; type?: FunnelChartAnimationType }): Promise<void>
ArgumentsTypeRequired
options{ duration?: number; easing?: FunnelChartEasing; enabled?: boolean; type?: FunnelChartAnimationType }Required

Return type: Promise<void>. Call the method after element registration and await its Promise result.

pauseAnimation

Pause the current animation.

typescript
pauseAnimation(): Promise<void>

Return type: Promise<void>. Call the method after element registration and await its Promise result.

resumeAnimation

Resume a paused animation.

typescript
resumeAnimation(): Promise<void>

Return type: Promise<void>. Call the method after element registration and await its Promise result.

replayAnimation

Replay the initial sweep from min → value(s). No-op when animation is off / reduced.

typescript
replayAnimation(): Promise<void>

Return type: Promise<void>. Call the method after element registration and await its Promise result.

hitTest

The box under a host-local CSS point (the nearest slot, within half a pitch), or null.

typescript
hitTest(cssX: number, cssY: number): Promise<FunnelChartPointerEventDetail | null>
ArgumentsTypeRequired
cssXnumberRequired
cssYnumberRequired

Return type: Promise<FunnelChartPointerEventDetail | null>. Call the method after element registration and await its Promise result.

showTooltipAt

An asynchronous method. Check the argument and return types below.

typescript
showTooltipAt(idOrIndex: string | number): Promise<FunnelChartPointerEventDetail | null>
ArgumentsTypeRequired
idOrIndexstring | numberRequired

Return type: Promise<FunnelChartPointerEventDetail | null>. Call the method after element registration and await its Promise result.

hideTooltip

Close the currently visible tooltip.

typescript
hideTooltip(): Promise<void>

Return type: Promise<void>. Call the method after element registration and await its Promise result.

getEngineStatus

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.

typescript
getEngineStatus(): Promise<ChartEngineStatus>

Return type: Promise<ChartEngineStatus>. Call the method after element registration and await its Promise result.