Box Plot.
PROSummarize the median and spread with boxes and whiskers.
LIVE EXAMPLE
Distribution by process
Appearance and style11
Axes and grid lines14
Legend and interaction13
Title and dimensions3
Calculate the median, quartiles, and whiskers from raw samples. 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-box-plot-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-box-plot-chart",
"props": {
"data": [
{
"category": "Process A",
"values": [21, 24, 25, 28, 29, 31, 35, 47]
},
{
"category": "Process B",
"values": [25, 28, 30, 32, 34, 35, 37, 39]
},
{
"category": "Process C",
"values": [20, 25, 29, 32, 35, 38, 45, 52]
}
],
"orientation": "vertical",
"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', 'box-plot 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
#Compare distributions across groups and explore outliers.
Whiskers follow the configured calculation rule. Inspect raw values as well when the sample is small.
Data contract
| Property | Input format |
|---|---|
data | Pass raw samples as { category, values: [...] } or provide summary statistics. |
orientation | The direction in which boxes are drawn. |
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 21 interactive feature examples and inspect their code. Select “Edit in preview” to combine more options in the settings panel above.
Notched boxesPRO
Show notches around the median together with mean markers.
View code
Horizontal distributionPRO
Compare horizontally when group names are long.
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
StatisticsPRO
Compare 4 examples of Statistics. Buttons and options update both the live result and source code.
View code
StylePRO
Compare 5 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-box-plot-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 |
|---|---|---|
BoxPlotDataDefault: undefined | Pass raw samples as { category, values: [...] } or provide summary statistics. | |
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 box) — the VALUE axis under `orientation="horizontal"`; a slot array adds top / bottom axes (a `linkedTo` slot mirrors the boxes). |
| yAxis | YAxisInputDefault: undefined | The value axis: one input, or slots (`[left, right]` = the dual y-axis, later slots alternate; `kind: 'log' | 'time'`, `linkedTo`) — the CATEGORY axis under `orientation="horizontal"` (a linked later slot mirrors it). |
| gridLines | CartesianGridLinesInputDefault: undefined | Grid lines: the value axis's on by default, the category axis's off (a category axis has no continuous grid). |
CartesianCrosshairInputDefault: undefined | Crosshair that follows the cursor across the plot. | |
CartesianZoomInputDefault: undefined | Settings for zooming and the visible range. | |
BoxPlotOrientationDefault: 'vertical' | The direction in which boxes are drawn. | |
| boxFillAlpha | numberDefault: DEFAULT_FILL_ALPHA | Set as an HTML attribute or JavaScript property. type: number. |
| boxWidth | numberDefault: BOX_DEFAULT_WIDTH_RATIO | The box's share of the slot pitch (0.6), clamped between `box-min-px` and `box-max-px`. |
| capWidth | numberDefault: BOX_DEFAULT_CAP_RATIO | The whisker caps' share of the box width (0.5; 0 hides them). |
| whiskerWidth | numberDefault: 1 | CSS px: the whisker / border thickness, the median thickness, the outlier radius. |
| medianWidth | numberDefault: 2 | Set as an HTML attribute or JavaScript property. type: number. |
| outlierRadius | numberDefault: 3 | Set as an HTML attribute or JavaScript property. type: number. |
booleanDefault: false | Set as an HTML attribute or JavaScript property. type: boolean. | |
| notchWidth | numberDefault: 0.5 | Set as an HTML attribute or JavaScript property. type: number. |
| showMean | booleanDefault: false | Set as an HTML attribute or JavaScript property. type: boolean. |
| meanSize | numberDefault: 6 | Set as an HTML attribute or JavaScript property. type: number. |
| 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 | BoxPlotEasingDefault: 'ease-out' | Allowed values: linear, ease-out, ease-in, ease-in-out. Default: 'ease-out'. |
| animationType | BoxPlotAnimationTypeDefault: undefined | Allowed values: initial, update. Default: undefined. |
Other properties 20
| 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 %). | |
| boxColor | stringDefault: DEFAULT_BOX_COLOR | The box colour: its border (and, at `box-fill-alpha`, its fill); `auto` whiskers / outliers follow it. |
| medianColor | stringDefault: DEFAULT_MEDIAN_COLOR | Set as an HTML attribute or JavaScript property. type: string. |
| whiskerColor | stringDefault: 'auto' | Set as an HTML attribute or JavaScript property. type: string. |
| outlierColor | stringDefault: 'auto' | Set as an HTML attribute or JavaScript property. type: string. |
| boxMinPx | numberDefault: BOX_DEFAULT_MIN_PX | Set as an HTML attribute or JavaScript property. type: number. |
| boxMaxPx | numberDefault: BOX_DEFAULT_MAX_PX | Set as an HTML attribute or JavaScript property. type: number. |
| meanColor | stringDefault: 'auto' | Set as an HTML attribute or JavaScript property. type: string. |
| whiskerRule | BoxPlotWhiskerRule | stringDefault: 'tukey' | Pass as a JavaScript property. type: BoxPlotWhiskerRule | string. |
| quantileMethod | BoxPlotQuantileMethod | stringDefault: 'linear' | Set as an HTML attribute or JavaScript property. type: BoxPlotQuantileMethod | string. |
| whiskerPercentile | numberDefault: 5 | Set as an HTML attribute or JavaScript property. type: number. |
| enableMouseTracking | booleanDefault: true | Set as an HTML attribute or JavaScript property. type: boolean. |
| tooltipFormat | (detail: BoxPlotPointEventDetail) => stringDefault: undefined | Pass as a JavaScript property. type: (detail: BoxPlotPointEventDetail) => string. |
| streamSource | BoxPlotStreamSourceDefault: 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. |
BoxPlotEngineModeDefault: 'auto' | Renderer selection: auto, standard, or pro. Engine selection is separate from permission to use a Pro chart type. | |
BoxPlotUnavailableBehaviourDefault: 'fallback' | Allowed values: fallback, error. Default: 'fallback'. |
Events 14
| Events | Detail type | Description |
|---|---|---|
BoxPlotRenderResult & { tier: BoxPlotEngineTier; engine?: ChartEngineStatus } | Emits rendering results in detail when chart drawing completes. | |
BoxPlotPointEventDetail | A point selection event. Read the selected data and index from CustomEvent.detail. | |
BoxPlotPointEventDetail | null | CustomEvent.detail type: BoxPlotPointEventDetail | null. Event names are case-sensitive. | |
CartesianCrosshairEventDetail | null | CustomEvent.detail type: CartesianCrosshairEventDetail | null. Event names are case-sensitive. | |
CartesianZoomChangeEventDetail | Fired after every zoom change (drag / pan / wheel / pinch / keyboard / api / reset) with the new state. | |
ChartPointContextMenuEventDetail<BoxPlotPointEventDetail> | CustomEvent.detail type: ChartPointContextMenuEventDetail<BoxPlotPointEventDetail>. 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. |
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<BoxPlotRenderResult> | Draws a frame now; rejects with the SyidaxLicenseError while the type is not entitled or the chart is frozen. | |
Promise<BoxPlotEngineTier> | An asynchronous method. Check the argument and return types below. | |
Promise<string | undefined> | An asynchronous method. Check the argument and return types below. | |
| data: BoxPlotData | Promise<void> | An asynchronous method. Check the argument and return types below. |
| datum: BoxPlotDatumInput | Promise<void> | Upsert one category (a tracked category replaces its box). |
| data: ReadonlyArray<BoxPlotDatumInput> | Promise<void> | An asynchronous method. Check the argument and return types below. |
| count: number | Promise<void> | Drop the oldest streamed categories (the `data` boxes are not the stream). |
| data: ReadonlyArray<BoxPlotDatumInput> | Promise<void> | An asynchronous method. Check the argument and return types below. |
Promise<BoxPlotStreamSource | undefined> | An asynchronous method. Check the argument and return types below. | |
| options: { duration?: number; easing?: BoxPlotEasing; enabled?: boolean; type?: BoxPlotAnimationType } | 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<BoxPlotPointEventDetail | null> | The box under a host-local CSS point (the nearest slot, within half a pitch), or null. |
| index: number | Promise<BoxPlotBox | null> | An asynchronous method. Check the argument and return types below. |
| category: string | Promise<BoxPlotBox | null> | An asynchronous method. Check the argument and return types below. |
Promise<number> | An asynchronous method. Check the argument and return types below. | |
Promise<BoxPlotBox[]> | An asynchronous method. Check the argument and return types below. | |
| index: number | Promise<BoxPlotStatistics | null> | An asynchronous method. Check the argument and return types below. |
Promise<string[]> | An asynchronous method. Check the argument and return types below. | |
Promise<BoxPlotExtent> | An asynchronous method. Check the argument and return types below. | |
Promise<BoxPlotDomain> | An asynchronous method. Check the argument and return types below. | |
| index: number | Promise<CartesianTooltipEventDetail | null> | An asynchronous method. Check the argument and return types below. |
Promise<void> | An asynchronous method. Check the argument and return types below. | |
| index: number | Promise<BoxPlotPointEventDetail | null> | An asynchronous method. Check the argument and return types below. |
| request: CartesianZoomRequest | Promise<CartesianZoomChangeEventDetail | null> | Zoom to explicit windows: `x` / `y` as `{ min, max }` or `[min, max]` (`null` clears that orientation); `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? }`); 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 — axes (`null` before the first layout). |
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.