Stem & Leaf.

COMMUNITY

Read a distribution while retaining raw values.

Live preview16 feature examples

LIVE EXAMPLE

Raw-value distribution

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 style3
Legend and interaction10
Title and dimensions3

Read the distribution while preserving observations as stems and leaves. 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-stem-leaf-chart.js';
  define0();

  const specs = [
    {
      "id": "example-chart",
      "tag": "sy-stem-leaf-chart",
      "props": {
        "engine": "standard",
        "values": [23, 25, 28, 29, 30, 31, 31, 32, 32, 33, 34, 34, 35, 35, 36, 37, 38, 39, 42, 45, 48, 52],
        "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', 'stem-leaf 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

#

Inspect the digit distribution of a small numeric sample.

Choose the digit split and rounding unit first. Use Histogram for very large samples.

Data contract

PropertyInput format
valuesAn array of raw numeric samples, displayed as stems and leaves.

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 16 interactive feature examples and inspect their code. Select “Edit in preview” to combine more options in the settings panel above.

Split stems

Split each stem into two rows to read dense distributions.

Interact with the chart to see results here.
View code

One decimal place

Show measurements from 2.3 to 5.2 with integer stems and tenths as leaves. In the key, 2 | 3 means 2.3.

Interact with the chart to see results here.
View code

Inspect values with the pointer

Point to data to view the value at that location.

Interact with the chart to see results here.
View code

Drag to zoom and pan

Drag to zoom and hold Shift to pan. Use Ctrl + wheel to zoom in or out.

Interact with the chart to see results here.
View code

Replay animation

Redraw the same example to inspect its initial display animation.

Interact with the chart to see results here.
View code

Animation

Compare 1 examples of Animation. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Large datasets

Compare 1 examples of Large datasets. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Size

Compare 1 examples of Size. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Tooltip

Compare 12 examples of Tooltip. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Data input

Compare 1 examples of Data input. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Zoom and pan

Compare 6 examples of Zoom and pan. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Context menu

Compare 1 examples of Context menu. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
View code

Data context menu

Compare 1 examples of Data context menu. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
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.

Interact with the chart to see results here.
View code

Overview

Compare 3 examples of Overview. Buttons and options update both the live result and source code.

Interact with the chart to see results here.
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.

Interact with the chart to see results here.
View code

API reference

#

The full public API for sy-stem-leaf-chart. Pass objects and arrays as JavaScript properties. Select a name to view usage code and type definitions.

Key properties

Attribute / PropertyType / DefaultDescription
StemLeafValuesDefault: []An array of raw numeric samples, displayed as stems and leaves.
numberDefault: 520Chart width in pixels. Update with ResizeObserver when the container changes.
numberDefault: 400Chart 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.
numberDefault: 10Stem unit — one stem spans this much (default 10: stems are the tens digit).
1 | 2Default: 11 (default) or 2: each stem splits into 0–4 / 5–9 half-rows.
showKeybooleanDefault: trueShow the reading key (`2 | 3 = 23`) under the plot.
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.
StemLeafTooltipInputDefault: undefinedTooltip settings for pointer-driven values, position, and content.
CartesianZoomInputDefault: undefinedSettings for zooming and the visible range.
animatedbooleanDefault: falseWhether to animate initial display and data changes.
animationDurationnumberDefault: 600Animation duration in milliseconds.
animationEasingStemLeafEasingDefault: 'ease-out'Allowed values: linear, ease-out, ease-in, ease-in-out. Default: 'ease-out'.
animationTypeStemLeafAnimationTypeDefault: undefinedAllowed values: initial, update. Default: undefined.
Other properties 9
Attribute / PropertyType / DefaultDescription
string | ReadonlyArray<string>Default: '#111827'Ink colour (single CSS colour / array / comma string — first colour wins).
activeColorstringDefault: '#2563eb'Accent for the hovered/focused leaf.
tooltipFormat(leaf: StemLeafPointEventDetail) => stringDefault: undefinedPass as a JavaScript property. type: (leaf: StemLeafPointEventDetail) => string.
enableMouseTrackingbooleanDefault: trueSet as an HTML attribute or JavaScript property. type: boolean.
StemLeafEngineModeDefault: 'auto'Renderer selection: auto, standard, or pro. Engine selection is separate from permission to use a Pro chart type.
StemLeafUnavailableBehaviourDefault: 'fallback'Allowed values: fallback, error, throw. Default: 'fallback'.
streamSourceStemLeafStreamSourceDefault: 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.
Events 13
EventsDetail typeDescription
StemLeafRenderResult & { tier: StemLeafEngineTier }Emits rendering results in detail when chart drawing completes.
StemLeafPointEventDetailA point selection event. Read the selected data and index from CustomEvent.detail.
StemLeafPointEventDetail | nullCustomEvent.detail type: StemLeafPointEventDetail | null. Event names are case-sensitive.
ChartPointContextMenuEventDetail<StemLeafPointEventDetail>CustomEvent.detail type: ChartPointContextMenuEventDetail<StemLeafPointEventDetail>. 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.
StemLeafTooltipShowEventDetailWhether to display the built-in tooltip.
voidCustomEvent.detail type: void. Event names are case-sensitive.
StemLeafTooltipActionEventDetailCustomEvent.detail type: StemLeafTooltipActionEventDetail. Event names are case-sensitive.
CartesianZoomChangeEventDetailFired after every zoom change (drag / pan / wheel / pinch / keyboard / api / reset) with the new viewport windows.
Methods 22

Stencil methods return Promises. Use await within an async function to read the result.

Method / ArgumentsReturn typeDescription
Promise<StemLeafRenderResult>An asynchronous method. Check the argument and return types below.
Promise<StemLeafEngineTier>An asynchronous method. Check the argument and return types below.
values: StemLeafValuesPromise<void>An asynchronous method. Check the argument and return types below.
value: numberPromise<void>An asynchronous method. Check the argument and return types below.
values: ReadonlyArray<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.
values: ReadonlyArray<number>Promise<void>An asynchronous method. Check the argument and return types below.
Promise<StemLeafStreamSource | undefined>An asynchronous method. Check the argument and return types below.
options: { duration?: number; easing?: StemLeafEasing; enabled?: boolean; type?: StemLeafAnimationType }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<{ sourceIndex: number; value: number; stemLabel: string; digit: number } | null>An asynchronous method. Check the argument and return types below.
sourceIndex: numberPromise<StemLeafPointEventDetail | null>An asynchronous method. Check the argument and return types below.
Promise<void>An asynchronous method. Check the argument and return types below.
request: CartesianZoomRequestPromise<CartesianZoomChangeEventDetail | null>Zoom to explicit viewport windows: `x` / `y` as `{ min, max }` or `[min, max]` over 0..1 (`null` clears that orientation).
factor: number, anchorFraction?: numberPromise<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 viewport units (`{ x?, y? }`, 1 = the whole plot); 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?: CartesianZoomExtentRequestPromise<CartesianZoomExtentDetail | null>The full extent (0..1 on both orientations, key `'0'`).
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.