Waterfall.
PROShow how increases and decreases accumulate into a final value.
LIVE EXAMPLE
Revenue changes
Appearance and style9
Axes and grid lines14
Legend and interaction13
Title and dimensions3
Add increases and decreases to the opening value to show the final total. 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-pro/components/sy-waterfall-chart.js';
define0();
// Pro: complete registerLicense at app startup using your issued certificate.
// The website preview certificate is not for use in customer apps.
const specs = [
{
"id": "example-chart",
"tag": "sy-waterfall-chart",
"props": {
"data": [
{
"category": "Opening",
"value": 100
},
{
"category": "New",
"value": 45
},
{
"category": "Cancellations",
"value": -20
},
{
"category": "Additions",
"value": 15
},
{
"category": "Total",
"kind": "total"
}
],
"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', 'waterfall example chart');
return element;
});
container.replaceChildren(...elements);
const chart = elements.at(-1);
const onEvent = event => {
console.log('pointClick', event.detail);
};
chart.addEventListener('pointClick', 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('pointClick', onEvent);
container.replaceChildren();
}
</script>Usage and data
#Explain the opening value, changes, and total for revenue, costs, or inventory.
total and subtotal differ from ordinary changes. Do not add a total again as a delta.
Data contract
| Property | Input format |
|---|---|
data | An array of { category, value?, kind? }. kind is delta, subtotal, or total. |
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.
Change labelsPRO
Read increase, decrease, and total values inside the chart.
View code
Increase and decrease colorsPRO
Use different colors for increases, decreases, and totals.
View code
Inspect values with the pointerPRO
Point to data to view the value at that location.
View code
Crosshair trackingPRO
Move the pointer to read horizontal and vertical coordinates alongside values.
View code
Drag to zoom and panPRO
Drag to zoom and hold Shift to pan. Use Ctrl + wheel to zoom in or out.
View code
Replay animationPRO
Redraw the same example to inspect its initial display animation.
View code
AnimationPRO
Compare 1 examples of Animation. Buttons and options update both the live result and source code.
View code
AxisPRO
Compare 6 examples of Axis. Buttons and options update both the live result and source code.
View code
CrosshairPRO
Compare 5 examples of Crosshair. Buttons and options update both the live result and source code.
View code
Data inputPRO
Compare 1 examples of Data input. Buttons and options update both the live result and source code.
View code
Large datasetsPRO
Compare 1 examples of Large datasets. Buttons and options update both the live result and source code.
View code
SizePRO
Compare 1 examples of Size. Buttons and options update both the live result and source code.
View code
StylePRO
Compare 4 examples of Style. Buttons and options update both the live result and source code.
View code
TooltipPRO
Compare 13 examples of Tooltip. Buttons and options update both the live result and source code.
View code
Zoom and panPRO
Compare 6 examples of Zoom and pan. Buttons and options update both the live result and source code.
View code
Context menuPRO
Compare 1 examples of Context menu. Buttons and options update both the live result and source code.
View code
Data context menuPRO
Compare 1 examples of Data context menu. Buttons and options update both the live result and source code.
View code
Read coordinates and dataPRO
Compare 1 examples of Read coordinates and data. Buttons and options update both the live result and source code.
View code
OverviewPRO
Compare 4 examples of Overview. Buttons and options update both the live result and source code.
View code
Streaming · Add and update live dataPRO
Compare 5 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-waterfall-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 |
|---|---|---|
WaterfallDataDefault: undefined | An array of { category, value?, kind? }. kind is delta, subtotal, or total. | |
numberDefault: 900 | 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. |
| xAxis | XAxisInputDefault: undefined | The category axis (its `label` / `show` / `format`; the slots are one per bar), or `[bottom, top, …]` slots (the multi x-axis: every slot a category axis over the bars — `position`, `linkedTo`, `format` per the shared contract). |
| yAxis | YAxisInputDefault: undefined | The value axis: one input, or `[left, right, …]` slots (the dual / multi y-axis; `kind: 'log' | 'time'` and `linkedTo` per the shared contract). |
| gridLines | CartesianGridLinesInputDefault: undefined | Grid lines: the value axis's on by default, the category axis's off. |
CartesianCrosshairInputDefault: undefined | Crosshair that follows the cursor across the plot. | |
CartesianZoomInputDefault: undefined | Settings for zooming and the visible range. | |
| upColor | stringDefault: DEFAULT_UP_COLOR | The bar colours: a rising delta, a falling delta, a total / subtotal; the connectors; the hovered / focused bar. |
| downColor | stringDefault: DEFAULT_DOWN_COLOR | Set as an HTML attribute or JavaScript property. type: string. |
| totalColor | stringDefault: DEFAULT_TOTAL_COLOR | Set as an HTML attribute or JavaScript property. type: string. |
| connectorWidth | numberDefault: 1 | The connector's thickness in CSS px, and its switch. |
| showConnectors | booleanDefault: true | Set as an HTML attribute or JavaScript property. type: boolean. |
| showTotal | booleanDefault: false | Set as an HTML attribute or JavaScript property. type: boolean. |
| totalLabel | stringDefault: WATERFALL_DEFAULT_TOTAL_LABEL | Set as an HTML attribute or JavaScript property. type: string. |
| showLabels | booleanDefault: false | The value labels (off by default): `label-mode` value (a delta's signed change, a total's running total) / running / both; `labelFormat(bar)` replaces the text. |
| labelMode | WaterfallLabelModeDefault: 'value' | Allowed values: value, running, both. Default: 'value'. |
| 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. |
CartesianTooltipInputDefault: undefined | Tooltip settings for pointer-driven values, position, and content. | |
| tooltipEnabled | booleanDefault: true | Set as an HTML attribute or JavaScript property. type: boolean. |
| animated | booleanDefault: false | Whether to animate initial display and data changes. |
| animationDuration | numberDefault: 600 | Animation duration in milliseconds. |
| animationEasing | WaterfallEasingDefault: 'ease-out' | Allowed values: linear, ease-out, ease-in, ease-in-out. Default: 'ease-out'. |
| animationType | WaterfallAnimationTypeDefault: undefined | Allowed values: initial, update. Default: undefined. |
Other properties 18
| Attribute / Property | Type / Default | Description |
|---|---|---|
| yMin | numberDefault: undefined | Set as an HTML attribute or JavaScript property. type: number. |
| yMax | numberDefault: undefined | Set as an HTML attribute or JavaScript property. type: number. |
numberDefault: 0.05 | The automatic domain pads the value span by this share (default 5 %); zero is always inside. | |
| connectorColor | stringDefault: DEFAULT_CONNECTOR_COLOR | Set as an HTML attribute or JavaScript property. type: string. |
| activeColor | stringDefault: DEFAULT_ACTIVE_COLOR | Set as an HTML attribute or JavaScript property. type: string. |
| barWidth | numberDefault: WATERFALL_DEFAULT_WIDTH_RATIO | The bar's share of the slot pitch (0.6), clamped between `bar-min-px` and `bar-max-px`. |
| barMinPx | numberDefault: WATERFALL_DEFAULT_MIN_PX | Set as an HTML attribute or JavaScript property. type: number. |
| barMaxPx | numberDefault: WATERFALL_DEFAULT_MAX_PX | Set as an HTML attribute or JavaScript property. type: number. |
| detectResult | booleanDefault: true | Recognise a last step given as a plain value equal to the running total as the RESULT bar (a total from zero; `detected: true`); off → it stays a delta. |
| lastResult | booleanDefault: undefined | True: the last merged step is a result spanning zero and the preceding running total, ignoring its value/colour. False: disable detection, preserving explicit datum kinds. Omitted: use detect-result. |
| labelFormat | (bar: WaterfallBar) => stringDefault: undefined | Pass as a JavaScript property. type: (bar: WaterfallBar) => string. |
| enableMouseTracking | booleanDefault: true | Set as an HTML attribute or JavaScript property. type: boolean. |
| tooltipFormat | (detail: WaterfallPointEventDetail) => stringDefault: undefined | Pass as a JavaScript property. type: (detail: WaterfallPointEventDetail) => string. |
| streamSource | WaterfallStreamSourceDefault: undefined | A stream source for live data. Check the contract for the specific type. |
| streamMax | numberDefault: undefined | The maximum number of streaming data points to retain. |
| streamWindow | numberDefault: undefined | The streaming data range to keep visible. |
WaterfallEngineModeDefault: 'auto' | Renderer selection: auto, standard, or pro. Engine selection is separate from permission to use a Pro chart type. | |
WaterfallUnavailableBehaviourDefault: 'fallback' | Allowed values: fallback, error. Default: 'fallback'. |
Events 14
| Events | Detail type | Description |
|---|---|---|
WaterfallRenderResult & { tier: WaterfallEngineTier; engine?: ChartEngineStatus } | Emits rendering results in detail when chart drawing completes. | |
WaterfallPointEventDetail | A point selection event. Read the selected data and index from CustomEvent.detail. | |
WaterfallPointEventDetail | null | CustomEvent.detail type: WaterfallPointEventDetail | null. Event names are case-sensitive. | |
CartesianCrosshairEventDetail | null | CustomEvent.detail type: CartesianCrosshairEventDetail | null. Event names are case-sensitive. | |
ChartPointContextMenuEventDetail<WaterfallPointEventDetail> | CustomEvent.detail type: ChartPointContextMenuEventDetail<WaterfallPointEventDetail>. Event names are case-sensitive. | |
{ count: number; replaced: number } | CustomEvent.detail type: { count: number; replaced: number }. Event names are case-sensitive. | |
{ dropped: number } | CustomEvent.detail type: { dropped: number }. Event names are case-sensitive. | |
CartesianTooltipEventDetail | Whether to display the built-in tooltip. | |
void | CustomEvent.detail type: void. Event names are case-sensitive. | |
CartesianTooltipActionEventDetail | CustomEvent.detail type: CartesianTooltipActionEventDetail. 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. | |
CartesianZoomChangeEventDetail | Fired after every zoom change (drag / pan / wheel / pinch / keyboard / api / reset) with the new state. |
Methods 33
Stencil methods return Promises. Use await within an async function to read the result.
| Method / Arguments | Return type | Description |
|---|---|---|
Promise<ChartDataTable> | Current normalized table, including the retained stream; independent of GPU availability. | |
Promise<WaterfallRenderResult> | Draws a frame now; rejects with the SyidaxLicenseError while the type is not entitled or the chart is frozen. | |
Promise<WaterfallEngineTier> | An asynchronous method. Check the argument and return types below. | |
Promise<string | undefined> | An asynchronous method. Check the argument and return types below. | |
| data: WaterfallData | Promise<void> | An asynchronous method. Check the argument and return types below. |
| datum: WaterfallDatumInput | Promise<void> | Upsert one step (a tracked category replaces its step; the running total re-tells). |
| data: ReadonlyArray<WaterfallDatumInput> | Promise<void> | An asynchronous method. Check the argument and return types below. |
| count: number | Promise<void> | Drop the oldest streamed steps (the `data` bars are not the stream). |
| data: ReadonlyArray<WaterfallDatumInput> | Promise<void> | An asynchronous method. Check the argument and return types below. |
Promise<WaterfallStreamSource | undefined> | An asynchronous method. Check the argument and return types below. | |
| options: { duration?: number; easing?: WaterfallEasing; enabled?: boolean; type?: WaterfallAnimationType } | 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<WaterfallPointEventDetail | null> | The bar under a host-local CSS point (the nearest slot, within half a pitch), or null. |
| index: number | Promise<WaterfallBar | null> | An asynchronous method. Check the argument and return types below. |
| category: string | Promise<WaterfallBar | null> | An asynchronous method. Check the argument and return types below. |
Promise<number> | An asynchronous method. Check the argument and return types below. | |
Promise<WaterfallBar[]> | An asynchronous method. Check the argument and return types below. | |
Promise<string[]> | An asynchronous method. Check the argument and return types below. | |
Promise<WaterfallExtent> | An asynchronous method. Check the argument and return types below. | |
Promise<WaterfallDomain> | An asynchronous method. Check the argument and return types below. | |
Promise<number> | The running total after the last bar (0 without bars). | |
| index: number | Promise<CartesianTooltipEventDetail | null> | Open the tooltip on a bar (the facade's `showTooltipAtPoint` routes here); null off the bars or with the tooltip off. |
Promise<void> | Close every tooltip. | |
| index: number | Promise<WaterfallPointEventDetail | null> | Move the keyboard focus ring to a bar (null off the bars); emits pointHover like the walk. |
| request: CartesianZoomRequest | Promise<CartesianZoomChangeEventDetail | null> | Zoom to explicit windows: `x` / `y` as `{ min, max }` or `[min, max]` (`null` clears that orientation; x is in slots — bar i sits at i); `xAxis` / `yAxis` name the axis by id or slot index (default: the primary axis). |
| factor: number, anchorFraction?: number | Promise<CartesianZoomChangeEventDetail | null> | Scale the current windows by `factor` (< 1 zooms in) around `anchorFraction` (0..1, default centre). |
| delta: { x?: number; y?: number } | Promise<CartesianZoomChangeEventDetail | null> | Slide the zoomed windows by data units (`{ x?, y? }` — x in slots); a no-op at the full extent. |
Promise<CartesianZoomChangeEventDetail | null> | Back to the full extent. | |
Promise<CartesianZoomState | null> | The current zoom state (`null` = full extent). | |
| request?: CartesianZoomExtentRequest | Promise<CartesianZoomExtentDetail | null> | The full extent (and key) of the primary — or the named — master axes (x: the slot range −0.5 … n − 0.5). |
Promise<ChartEngineStatus> | Requested engine vs what runs, and why (CHART-ADD-08): the decision for the current inputs, read without side effects (ProChartLicense.engineStatus); a renderer that failed at run time reports engine-unsupported. |
No matching APIs.