Bubble.
COMMUNITYRead three measures through point position and size.
LIVE EXAMPLE
Market comparison
Appearance and style9
Axes and grid lines14
Legend and interaction13
Title and dimensions3
Show X and Y as position and z as bubble size. 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/components/sy-bubble-chart.js';
define0();
const specs = [
{
"id": "example-chart",
"tag": "sy-bubble-chart",
"props": {
"data": [
{
"x": 20,
"y": 70,
"z": 30,
"name": "A"
},
{
"x": 45,
"y": 55,
"z": 60,
"name": "B"
},
{
"x": 75,
"y": 80,
"z": 45,
"name": "C"
},
{
"x": 60,
"y": 30,
"z": 20,
"name": "D"
}
],
"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', 'bubble 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 markets, products, or projects with two coordinates and a magnitude.
Overlapping bubbles can hide small items. State the meaning and unit of z.
Data contract
| Property | Input format |
|---|---|
data | An array of { x, y, z, name? }. x and y determine position; z determines size. |
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 22 interactive feature examples and inspect their code. Select “Edit in preview” to combine more options in the settings panel above.
Packed layout
Arrange bubbles without overlap to compare their magnitudes.
View code
Bubble size range
Set the radii of the smallest and largest bubbles.
View code
Inspect values with the pointer
Point to data to view the value at that location.
View code
Crosshair tracking
Move the pointer to read horizontal and vertical coordinates alongside values.
View code
Drag to zoom and pan
Drag to zoom and hold Shift to pan. Use Ctrl + wheel to zoom in or out.
View code
Replay animation
Redraw the same example to inspect its initial display animation.
View code
Animation
Compare 1 examples of Animation. Buttons and options update both the live result and source code.
View code
Axis
Compare 7 examples of Axis. Buttons and options update both the live result and source code.
View code
Color
Compare 4 examples of Color. Buttons and options update both the live result and source code.
View code
Crosshair
Compare 5 examples of Crosshair. Buttons and options update both the live result and source code.
View code
Data input
Compare 1 examples of Data input. Buttons and options update both the live result and source code.
View code
Large datasets
Compare 1 examples of Large datasets. Buttons and options update both the live result and source code.
View code
Size
Compare 1 examples of Size. Buttons and options update both the live result and source code.
View code
Tooltip
Compare 13 examples of Tooltip. Buttons and options update both the live result and source code.
View code
Zoom and pan
Compare 6 examples of Zoom and pan. Buttons and options update both the live result and source code.
View code
Context menu
Compare 1 examples of Context menu. Buttons and options update both the live result and source code.
View code
Data context menu
Compare 1 examples of Data context menu. Buttons and options update both the live result and source code.
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.
View code
Overview
Compare 5 examples of Overview. Buttons and options update both the live result and source code.
View code
Streaming · Live updatesPRO
Select Start to add one data point at a time. The latest 40 items are shown, with controls for update speed, pause, and reset.
View code
Streaming · Add batchesPRO
Select Start to add four data points at a time. The latest 40 items are shown, with controls for update speed, pause, and reset.
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-bubble-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 |
|---|---|---|
BubbleDataDefault: undefined | An array of { x, y, z, name? }. x and y determine position; z determines size. | |
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 x axis (its `label` / `min` / `max` / `format` / `show` / `kind`), or `[bottom, top, …]` slots (the multi x-axis: `position`, `linkedTo`, `kind: 'time' | 'log'` per the shared contract). |
| yAxis | YAxisInputDefault: undefined | The y axis: one input, or `[left, right, …]` slots (the dual / multi y-axis). |
| gridLines | CartesianGridLinesInputDefault: undefined | Grid lines: both axes on by default. |
CartesianCrosshairInputDefault: undefined | Crosshair that follows the cursor across the plot. | |
CartesianZoomInputDefault: undefined | Settings for zooming and the visible range. | |
| fillAlpha | numberDefault: DEFAULT_FILL_ALPHA | Set as an HTML attribute or JavaScript property. type: number. |
| borderWidth | numberDefault: 1 | Set as an HTML attribute or JavaScript property. type: number. |
| minRadius | numberDefault: BUBBLE_DEFAULT_MIN_RADIUS | The radius range in CSS px the z range maps onto. |
| maxRadius | numberDefault: BUBBLE_DEFAULT_MAX_RADIUS | Set as an HTML attribute or JavaScript property. type: number. |
| sizeScale | BubbleSizeScale | stringDefault: 'area' | `area` (the disc area proportional to z; the default) or `radius`. |
BubbleLayoutMode | stringDefault: 'xy' | Set as an HTML attribute or JavaScript property. type: BubbleLayoutMode | string. | |
| packPadding | numberDefault: 2 | Pack mode: the gap between tangent bubbles in CSS px; `contain` only shrinks the cluster to fit, `fill` scales it to touch the shorter side. |
BubbleShading | stringDefault: 'flat' | Set as an HTML attribute or JavaScript property. type: BubbleShading | string. | |
| shadeStrength | numberDefault: 1 | 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 | BubbleEasingDefault: 'ease-out' | Allowed values: linear, ease-out, ease-in, ease-in-out. Default: 'ease-out'. |
| animationType | BubbleAnimationTypeDefault: undefined | Allowed values: initial, update. Default: undefined. |
Other properties 16
| Attribute / Property | Type / Default | Description |
|---|---|---|
numberDefault: BUBBLE_DEFAULT_PADDING | The automatic domain pads each span by this share (default 5 %). | |
stringDefault: DEFAULT_COLOR | The bubble colour: the border, and the fill at `fill-alpha`. | |
| borderColor | stringDefault: 'auto' | The border colour (`auto` = the bubble colour) and its thickness in CSS px (0 = none). |
| activeColor | stringDefault: DEFAULT_ACTIVE_COLOR | The accent fill of the hovered / focused bubble. |
| zMin | numberDefault: undefined | The z range (the data's when unset): z at or below `z-min` takes the min radius, at or above `z-max` the max. |
| zMax | numberDefault: undefined | Set as an HTML attribute or JavaScript property. type: number. |
| packFit | BubblePackFit | stringDefault: 'contain' | Set as an HTML attribute or JavaScript property. type: BubblePackFit | string. |
| visualMap | VisualMapBinding | nullDefault: undefined | Pass as a JavaScript property. type: VisualMapBinding | null. |
| enableMouseTracking | booleanDefault: true | Set as an HTML attribute or JavaScript property. type: boolean. |
| tooltipFormat | (detail: BubblePointEventDetail) => stringDefault: undefined | Pass as a JavaScript property. type: (detail: BubblePointEventDetail) => string. |
| streamSource | BubbleStreamSourceDefault: 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. |
BubbleEngineModeDefault: 'auto' | Renderer selection: auto, standard, or pro. Engine selection is separate from permission to use a Pro chart type. | |
| proThreshold | numberDefault: BUBBLE_DEFAULT_PRO_THRESHOLD | `auto` switches to the WebGPU renderer at this many bubbles (a missing or non-positive value uses 50,000). |
BubbleUnavailableBehaviourDefault: 'fallback' | `fallback` (the Standard renderer and the notice) or `error` (an explicit `engine="pro"` that cannot run throws). |
Events 14
| Events | Detail type | Description |
|---|---|---|
BubbleRenderResult & { tier: BubbleEngineTier } | Emits rendering results in detail when chart drawing completes. | |
BubblePointEventDetail | A point selection event. Read the selected data and index from CustomEvent.detail. | |
BubblePointEventDetail | null | CustomEvent.detail type: BubblePointEventDetail | null. Event names are case-sensitive. | |
CartesianCrosshairEventDetail | null | CustomEvent.detail type: CartesianCrosshairEventDetail | null. Event names are case-sensitive. | |
ChartPointContextMenuEventDetail<BubblePointEventDetail> | CustomEvent.detail type: ChartPointContextMenuEventDetail<BubblePointEventDetail>. 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. | |
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 35
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<BubbleRenderResult> | An asynchronous method. Check the argument and return types below. | |
Promise<BubbleEngineTier> | An asynchronous method. Check the argument and return types below. | |
Promise<string | undefined> | Why the WebGPU renderer could not run (the fallback notice's reason); undefined when nothing fell back. | |
| data: BubbleData | Promise<void> | An asynchronous method. Check the argument and return types below. |
| datum: BubbleDatumInput | Promise<void> | Append one bubble to the stream. |
| data: ReadonlyArray<BubbleDatumInput> | Promise<void> | An asynchronous method. Check the argument and return types below. |
| count: number | Promise<void> | Drop the oldest streamed bubbles (the `data` bubbles are not the stream); with nothing streamed it does nothing and asks nothing. |
| data: ReadonlyArray<BubbleDatumInput> | Promise<void> | An asynchronous method. Check the argument and return types below. |
Promise<BubbleStreamSource | undefined> | The stream session's source (Chart Pro): like the stream methods it waits for a license still being confirmed. | |
| options: { duration?: number; easing?: BubbleEasing; enabled?: boolean; type?: BubbleAnimationType } | 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<BubblePointEventDetail | null> | The bubble under a host-local CSS point (the smallest disc containing it), or null. |
| index: number | Promise<BubblePoint | null> | An asynchronous method. Check the argument and return types below. |
Promise<number> | An asynchronous method. Check the argument and return types below. | |
Promise<BubblePoint[]> | An asynchronous method. Check the argument and return types below. | |
Promise<BubbleExtent> | An asynchronous method. Check the argument and return types below. | |
Promise<BubbleDomain> | An asynchronous method. Check the argument and return types below. | |
Promise<BubbleRadiusScale> | The z → radius mapping the chart resolved (the z range, the radius range in CSS px, the scale). | |
Promise<BubblePackLayout | null> | An asynchronous method. Check the argument and return types below. | |
| binding: VisualMapBinding | null | Promise<VisualMapBinding | null> | Bind (or clear) a visual map: every bubble is filled through it on the next frame (a datum's own colour still wins). |
Promise<VisualMapBinding | null> | An asynchronous method. Check the argument and return types below. | |
| request?: VisualMapExtentRequest | Promise<VisualMapExtent | null> | The extent a bound `sy-visual-map` adopts as its domain: z (`value` / `z`), x, y, or the index range. |
| index: number | Promise<CartesianTooltipEventDetail | null> | Open the tooltip on a bubble (the facade's `showTooltipAtPoint` routes here); null off the bubbles or with the tooltip off. |
Promise<void> | Close every tooltip. | |
| index: number | Promise<BubblePointEventDetail | null> | Move the keyboard focus ring to a bubble (null off the bubbles); 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); `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 — master axes (pack mode: the unit square). |
Promise<ChartEngineStatus> | The requested engine, the engine that draws and why (ROADMAP-loading §5.3, CHART-ADD-08) — the last engine decision. A Chart Pro license decision names `chart.webgpu` and its state; renderer causes (not in this build, no WebGPU, a failed GPU) stay apart and never list an entitlement. |
No matching APIs.