Funnel.

COMMUNITY

Show the quantity remaining through successive stages.

Live preview20 feature examples

LIVE EXAMPLE

Conversion stages

Match the page theme
Interact with the chart to see selection and range-change results here.
OptionsChanges are reflected in the preview and code.
Appearance and style8
Legend and interaction11
Title and dimensions3

Inspect the count at each stage from acquisition to purchase. All values are sample data.

View code
Current preview
<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",
        "data": [
          {
            "name": "Visits",
            "value": 1000
          },
          {
            "name": "Views",
            "value": 680
          },
          {
            "name": "Cart",
            "value": 320
          },
          {
            "name": "Purchase",
            "value": 150
          }
        ],
        "colors": ["#8263d9", "#239c91", "#e99954", "#d76c8f", "#4d89c4", "#95a551"],
        "showPercent": true,
        "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', 'funnel 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

#

Analyze conversion from visits to purchases or progression through sales stages.

Do not connect values from different populations as consecutive stages. Preserve the stage order.

Data contract

PropertyInput format
dataAn array of stages as { name, value }.
showPercentWhether to show each stage's percentage of the sum of stage values.

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.

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.

Shared sy-chart API versus direct tags

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 / PropertyType / DefaultDescription
FunnelChartDataDefault: []An array of stages as { name, value }.
numberDefault: 420Chart width in pixels. Update with ResizeObserver when the container changes.
numberDefault: 360Chart height in pixels.
brandLogostringDefault: undefinedThe 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`true` makes a PYRAMID — point at the top, widening to the base.
neckWidthnumberDefault: 0.3Neck width as a fraction of the full width (funnel only).
neckHeightnumberDefault: 0.25Neck height as a fraction of the total height (funnel only; the straight bottom band).
numberDefault: 2Vertical gap between sections (px).
labelPlacementFunnelLabelPlacementDefault: 'inside'Allowed values: none, left, right, inside. Default: 'inside'.
labelFontSizenumberDefault: 12Set as an HTML attribute or JavaScript property. type: number.
showValuebooleanDefault: trueSet as an HTML attribute or JavaScript property. type: boolean.
showPercentbooleanDefault: falseWhether to show each stage's percentage of the sum of stage values.
chartTitlestringDefault: undefinedThe title inside the chart. Explain the data's unit and meaning alongside it.
chartSubtitlestringDefault: undefinedThe subtitle inside the chart.
tooltipShowbooleanDefault: trueWhether to display the built-in tooltip.
FunnelChartTooltipInputDefault: undefinedTooltip settings for pointer-driven values, position, and content.
booleanDefault: falseWhether to show a legend for series or items.
legendPositionFunnelChartLegendPositionDefault: 'bottom'Where the legend is positioned.
animatedbooleanDefault: falseWhether to animate initial display and data changes.
animationDurationnumberDefault: 700Animation duration in milliseconds.
animationEasingFunnelChartEasingDefault: 'ease-out'Allowed values: linear, ease-out, ease-in, ease-in-out. Default: 'ease-out'.
animationTypeFunnelChartAnimationTypeDefault: undefinedAllowed values: initial, update. Default: undefined.
Other properties 18
Attribute / PropertyType / DefaultDescription
stringDefault: '#2563eb'Set as an HTML attribute or JavaScript property. type: string.
ReadonlyArray<string>Default: undefinedPer-section palette. Per-section `color` always wins.
labelColorstringDefault: '#374151'Set as an HTML attribute or JavaScript property. type: string.
insideLabelColorstringDefault: '#ffffff'Set as an HTML attribute or JavaScript property. type: string.
valueFormatstringDefault: undefinedSet as an HTML attribute or JavaScript property. type: string.
leaderColorstringDefault: '#cbd5e1'Set as an HTML attribute or JavaScript property. type: string.
tooltipFormat(detail: FunnelChartPointerEventDetail) => stringDefault: undefinedPass as a JavaScript property. type: (detail: FunnelChartPointerEventDetail) => string.
enableMouseTrackingbooleanDefault: trueSet as an HTML attribute or JavaScript property. type: boolean.
inactiveOtherSectionsbooleanDefault: falseSet as an HTML attribute or JavaScript property. type: boolean.
inactiveSectionOpacitynumberDefault: 0.3Set as an HTML attribute or JavaScript property. type: number.
activeSectionIndexnumberDefault: undefinedSet as an HTML attribute or JavaScript property. type: number.
legendItemsLegendItem[]Default: undefinedPass as a JavaScript property. type: LegendItem[].
streamSourceFunnelChartStreamSourceDefault: undefinedA stream source for live data. Check the contract for the specific type.
streamWindownumberDefault: undefinedThe streaming data range to keep visible.
streamMaxnumberDefault: undefinedThe 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.
proThresholdnumberDefault: 50_000Set as an HTML attribute or JavaScript property. type: number.
FunnelChartUnavailableBehaviourDefault: 'fallback'Allowed values: fallback, error, throw. Default: 'fallback'.
Events 14
EventsDetail typeDescription
FunnelChartRenderResult & { tier: FunnelChartEngineTier }Emits rendering results in detail when chart drawing completes.
FunnelChartPointerEventDetailCustomEvent.detail type: FunnelChartPointerEventDetail. Event names are case-sensitive.
FunnelChartPointerEventDetail | nullCustomEvent.detail type: FunnelChartPointerEventDetail | null. Event names are case-sensitive.
ChartPointContextMenuEventDetail<FunnelChartPointerEventDetail>CustomEvent.detail type: ChartPointContextMenuEventDetail<FunnelChartPointerEventDetail>. Event names are case-sensitive.
FunnelChartTooltipShowEventDetailWhether to display the built-in tooltip.
voidCustomEvent.detail type: void. Event names are case-sensitive.
FunnelChartTooltipActionEventDetailCustomEvent.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.
voidCustomEvent.detail type: void. Event names are case-sensitive.
voidCustomEvent.detail type: void. Event names are case-sensitive.
voidCustomEvent.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 / ArgumentsReturn typeDescription
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: FunnelChartDataPromise<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 | numberPromise<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 | numberPromise<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?: numberPromise<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: numberPromise<FunnelChartPointerEventDetail | null>An asynchronous method. Check the argument and return types below.
idOrIndex: string | numberPromise<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.