Bubble.

COMMUNITY

Read three measures through point position and size.

Live preview22 feature examples

LIVE EXAMPLE

Market comparison

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 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
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-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

PropertyInput format
dataAn 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.

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-bubble-chart. Pass objects and arrays as JavaScript properties. Select a name to view usage code and type definitions.

Key properties

Attribute / PropertyType / DefaultDescription
BubbleDataDefault: undefinedAn array of { x, y, z, name? }. x and y determine position; z determines size.
numberDefault: 900Chart 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.
xAxisXAxisInputDefault: undefinedThe 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).
yAxisYAxisInputDefault: undefinedThe y axis: one input, or `[left, right, …]` slots (the dual / multi y-axis).
gridLinesCartesianGridLinesInputDefault: undefinedGrid lines: both axes on by default.
CartesianCrosshairInputDefault: undefinedCrosshair that follows the cursor across the plot.
CartesianZoomInputDefault: undefinedSettings for zooming and the visible range.
fillAlphanumberDefault: DEFAULT_FILL_ALPHASet as an HTML attribute or JavaScript property. type: number.
borderWidthnumberDefault: 1Set as an HTML attribute or JavaScript property. type: number.
minRadiusnumberDefault: BUBBLE_DEFAULT_MIN_RADIUSThe radius range in CSS px the z range maps onto.
maxRadiusnumberDefault: BUBBLE_DEFAULT_MAX_RADIUSSet as an HTML attribute or JavaScript property. type: number.
sizeScaleBubbleSizeScale | 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.
packPaddingnumberDefault: 2Pack 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.
shadeStrengthnumberDefault: 1Set as an HTML attribute or JavaScript property. type: number.
chartTitlestringDefault: undefinedThe title inside the chart. Explain the data's unit and meaning alongside it.
chartSubtitlestringDefault: undefinedThe subtitle inside the chart.
CartesianTooltipInputDefault: undefinedTooltip settings for pointer-driven values, position, and content.
tooltipEnabledbooleanDefault: trueSet as an HTML attribute or JavaScript property. type: boolean.
animatedbooleanDefault: falseWhether to animate initial display and data changes.
animationDurationnumberDefault: 600Animation duration in milliseconds.
animationEasingBubbleEasingDefault: 'ease-out'Allowed values: linear, ease-out, ease-in, ease-in-out. Default: 'ease-out'.
animationTypeBubbleAnimationTypeDefault: undefinedAllowed values: initial, update. Default: undefined.
Other properties 16
Attribute / PropertyType / DefaultDescription
numberDefault: BUBBLE_DEFAULT_PADDINGThe automatic domain pads each span by this share (default 5 %).
stringDefault: DEFAULT_COLORThe bubble colour: the border, and the fill at `fill-alpha`.
borderColorstringDefault: 'auto'The border colour (`auto` = the bubble colour) and its thickness in CSS px (0 = none).
activeColorstringDefault: DEFAULT_ACTIVE_COLORThe accent fill of the hovered / focused bubble.
zMinnumberDefault: undefinedThe z range (the data's when unset): z at or below `z-min` takes the min radius, at or above `z-max` the max.
zMaxnumberDefault: undefinedSet as an HTML attribute or JavaScript property. type: number.
packFitBubblePackFit | stringDefault: 'contain'Set as an HTML attribute or JavaScript property. type: BubblePackFit | string.
visualMapVisualMapBinding | nullDefault: undefinedPass as a JavaScript property. type: VisualMapBinding | null.
enableMouseTrackingbooleanDefault: trueSet as an HTML attribute or JavaScript property. type: boolean.
tooltipFormat(detail: BubblePointEventDetail) => stringDefault: undefinedPass as a JavaScript property. type: (detail: BubblePointEventDetail) => string.
streamSourceBubbleStreamSourceDefault: undefinedA stream source for live data. Check the contract for the specific type.
streamMaxnumberDefault: undefinedThe maximum number of streaming data points to retain.
streamWindownumberDefault: undefinedThe 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.
proThresholdnumberDefault: 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
EventsDetail typeDescription
BubbleRenderResult & { tier: BubbleEngineTier }Emits rendering results in detail when chart drawing completes.
BubblePointEventDetailA point selection event. Read the selected data and index from CustomEvent.detail.
BubblePointEventDetail | nullCustomEvent.detail type: BubblePointEventDetail | null. Event names are case-sensitive.
CartesianCrosshairEventDetail | nullCustomEvent.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.
CartesianTooltipEventDetailWhether to display the built-in tooltip.
voidCustomEvent.detail type: void. Event names are case-sensitive.
CartesianTooltipActionEventDetailCustomEvent.detail type: CartesianTooltipActionEventDetail. 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.
CartesianZoomChangeEventDetailFired 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 / ArgumentsReturn typeDescription
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: BubbleDataPromise<void>An asynchronous method. Check the argument and return types below.
datum: BubbleDatumInputPromise<void>Append one bubble to the stream.
data: ReadonlyArray<BubbleDatumInput>Promise<void>An asynchronous method. Check the argument and return types below.
count: numberPromise<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: numberPromise<BubblePointEventDetail | null>The bubble under a host-local CSS point (the smallest disc containing it), or null.
index: numberPromise<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 | nullPromise<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?: VisualMapExtentRequestPromise<VisualMapExtent | null>The extent a bound `sy-visual-map` adopts as its domain: z (`value` / `z`), x, y, or the index range.
index: numberPromise<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: numberPromise<BubblePointEventDetail | null>Move the keyboard focus ring to a bubble (null off the bubbles); emits pointHover like the walk.
request: CartesianZoomRequestPromise<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?: 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 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?: CartesianZoomExtentRequestPromise<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.