Skip to content

Bubble

Compare two measures while bubble area represents a third measure.

Chart ID: bubble. Independent import: @revolist/charts/bubble.

Loading chart…

Compare X and Y measures while bubble area adds a non-negative size measure. Read position and size separately; a large bubble does not necessarily have a large Y value.

Bind numeric X and Y series explicitly. Bubble marks also require a non-negative size series. Channels reference stable series IDs, not labels. Parallel channel arrays can describe independent scatter/bubble groups.

The roles below describe the chart's data contract. Generic category/value roles resolve from the dataset; explicitly bind specialized numeric roles as shown in the complete example.

Data roleField count
category1 or more
x1 or more
y1 or more
size1 or more

Download the complete sample data and settings (JSON). See Data & Configuration for mapping, null values, updates and lifecycle rules.

Install the package using the installation guide, give the host an explicit height, and call createBubbleChart after the host mounts. This factory fixes the chart type to bubble.

<div id="chart" style="width: 100%; height: 450px;"></div>
Complete runnable TypeScript example with sample data
import { createBubbleChart } from '@revolist/charts/bubble';
const container = document.getElementById('chart')!;
const chart = await createBubbleChart({
container,
"dataset": {
"revision": 0,
"source": "client",
"categories": [
{
"id": "preview-category-0",
"label": "Alpha",
"path": [
"Alpha"
],
"labels": [
"Alpha"
],
"depth": 1,
"kind": "leaf"
},
{
"id": "preview-category-1",
"label": "Beta",
"path": [
"Beta"
],
"labels": [
"Beta"
],
"depth": 1,
"kind": "leaf"
},
{
"id": "preview-category-2",
"label": "Gamma",
"path": [
"Gamma"
],
"labels": [
"Gamma"
],
"depth": 1,
"kind": "leaf"
},
{
"id": "preview-category-3",
"label": "Delta",
"path": [
"Delta"
],
"labels": [
"Delta"
],
"depth": 1,
"kind": "leaf"
},
{
"id": "preview-category-4",
"label": "Epsilon",
"path": [
"Epsilon"
],
"labels": [
"Epsilon"
],
"depth": 1,
"kind": "leaf"
}
],
"series": [
{
"id": "preview-series-0",
"label": "Cost",
"columnPath": [
"Cost"
],
"labels": [
"Cost"
],
"kind": "leaf",
"prop": "preview-0"
},
{
"id": "preview-series-1",
"label": "Revenue",
"columnPath": [
"Revenue"
],
"labels": [
"Revenue"
],
"kind": "leaf",
"prop": "preview-1"
},
{
"id": "preview-series-2",
"label": "Volume",
"columnPath": [
"Volume"
],
"labels": [
"Volume"
],
"kind": "leaf",
"prop": "preview-2"
}
],
"values": [
[
18,
34,
12
],
[
31,
52,
28
],
[
46,
41,
18
],
[
58,
73,
42
],
[
76,
61,
32
]
],
"analyticalFrame": {
"fields": [
{
"id": "pivot:category",
"label": "pivot:category",
"role": "dimension",
"semanticType": "category"
},
{
"id": "pivot:series",
"label": "pivot:series",
"role": "dimension",
"semanticType": "category"
},
{
"id": "preview-series-0",
"label": "Cost",
"role": "measure",
"semanticType": "number",
"sourceField": "preview-0"
},
{
"id": "preview-series-1",
"label": "Revenue",
"role": "measure",
"semanticType": "number",
"sourceField": "preview-1"
},
{
"id": "preview-series-2",
"label": "Volume",
"role": "measure",
"semanticType": "number",
"sourceField": "preview-2"
}
],
"observations": [
{
"id": "[\"preview-category-0\",\"preview-series-0\"]",
"dimensions": {
"pivot:category": {
"value": "Alpha",
"label": "Alpha",
"path": [
"Alpha"
],
"labels": [
"Alpha"
]
},
"pivot:series": {
"value": "Cost",
"label": "Cost",
"path": [
"Cost"
],
"labels": [
"Cost"
]
}
},
"measures": {
"preview-series-0": 18
}
},
{
"id": "[\"preview-category-0\",\"preview-series-1\"]",
"dimensions": {
"pivot:category": {
"value": "Alpha",
"label": "Alpha",
"path": [
"Alpha"
],
"labels": [
"Alpha"
]
},
"pivot:series": {
"value": "Revenue",
"label": "Revenue",
"path": [
"Revenue"
],
"labels": [
"Revenue"
]
}
},
"measures": {
"preview-series-1": 34
}
},
{
"id": "[\"preview-category-0\",\"preview-series-2\"]",
"dimensions": {
"pivot:category": {
"value": "Alpha",
"label": "Alpha",
"path": [
"Alpha"
],
"labels": [
"Alpha"
]
},
"pivot:series": {
"value": "Volume",
"label": "Volume",
"path": [
"Volume"
],
"labels": [
"Volume"
]
}
},
"measures": {
"preview-series-2": 12
}
},
{
"id": "[\"preview-category-1\",\"preview-series-0\"]",
"dimensions": {
"pivot:category": {
"value": "Beta",
"label": "Beta",
"path": [
"Beta"
],
"labels": [
"Beta"
]
},
"pivot:series": {
"value": "Cost",
"label": "Cost",
"path": [
"Cost"
],
"labels": [
"Cost"
]
}
},
"measures": {
"preview-series-0": 31
}
},
{
"id": "[\"preview-category-1\",\"preview-series-1\"]",
"dimensions": {
"pivot:category": {
"value": "Beta",
"label": "Beta",
"path": [
"Beta"
],
"labels": [
"Beta"
]
},
"pivot:series": {
"value": "Revenue",
"label": "Revenue",
"path": [
"Revenue"
],
"labels": [
"Revenue"
]
}
},
"measures": {
"preview-series-1": 52
}
},
{
"id": "[\"preview-category-1\",\"preview-series-2\"]",
"dimensions": {
"pivot:category": {
"value": "Beta",
"label": "Beta",
"path": [
"Beta"
],
"labels": [
"Beta"
]
},
"pivot:series": {
"value": "Volume",
"label": "Volume",
"path": [
"Volume"
],
"labels": [
"Volume"
]
}
},
"measures": {
"preview-series-2": 28
}
},
{
"id": "[\"preview-category-2\",\"preview-series-0\"]",
"dimensions": {
"pivot:category": {
"value": "Gamma",
"label": "Gamma",
"path": [
"Gamma"
],
"labels": [
"Gamma"
]
},
"pivot:series": {
"value": "Cost",
"label": "Cost",
"path": [
"Cost"
],
"labels": [
"Cost"
]
}
},
"measures": {
"preview-series-0": 46
}
},
{
"id": "[\"preview-category-2\",\"preview-series-1\"]",
"dimensions": {
"pivot:category": {
"value": "Gamma",
"label": "Gamma",
"path": [
"Gamma"
],
"labels": [
"Gamma"
]
},
"pivot:series": {
"value": "Revenue",
"label": "Revenue",
"path": [
"Revenue"
],
"labels": [
"Revenue"
]
}
},
"measures": {
"preview-series-1": 41
}
},
{
"id": "[\"preview-category-2\",\"preview-series-2\"]",
"dimensions": {
"pivot:category": {
"value": "Gamma",
"label": "Gamma",
"path": [
"Gamma"
],
"labels": [
"Gamma"
]
},
"pivot:series": {
"value": "Volume",
"label": "Volume",
"path": [
"Volume"
],
"labels": [
"Volume"
]
}
},
"measures": {
"preview-series-2": 18
}
},
{
"id": "[\"preview-category-3\",\"preview-series-0\"]",
"dimensions": {
"pivot:category": {
"value": "Delta",
"label": "Delta",
"path": [
"Delta"
],
"labels": [
"Delta"
]
},
"pivot:series": {
"value": "Cost",
"label": "Cost",
"path": [
"Cost"
],
"labels": [
"Cost"
]
}
},
"measures": {
"preview-series-0": 58
}
},
{
"id": "[\"preview-category-3\",\"preview-series-1\"]",
"dimensions": {
"pivot:category": {
"value": "Delta",
"label": "Delta",
"path": [
"Delta"
],
"labels": [
"Delta"
]
},
"pivot:series": {
"value": "Revenue",
"label": "Revenue",
"path": [
"Revenue"
],
"labels": [
"Revenue"
]
}
},
"measures": {
"preview-series-1": 73
}
},
{
"id": "[\"preview-category-3\",\"preview-series-2\"]",
"dimensions": {
"pivot:category": {
"value": "Delta",
"label": "Delta",
"path": [
"Delta"
],
"labels": [
"Delta"
]
},
"pivot:series": {
"value": "Volume",
"label": "Volume",
"path": [
"Volume"
],
"labels": [
"Volume"
]
}
},
"measures": {
"preview-series-2": 42
}
},
{
"id": "[\"preview-category-4\",\"preview-series-0\"]",
"dimensions": {
"pivot:category": {
"value": "Epsilon",
"label": "Epsilon",
"path": [
"Epsilon"
],
"labels": [
"Epsilon"
]
},
"pivot:series": {
"value": "Cost",
"label": "Cost",
"path": [
"Cost"
],
"labels": [
"Cost"
]
}
},
"measures": {
"preview-series-0": 76
}
},
{
"id": "[\"preview-category-4\",\"preview-series-1\"]",
"dimensions": {
"pivot:category": {
"value": "Epsilon",
"label": "Epsilon",
"path": [
"Epsilon"
],
"labels": [
"Epsilon"
]
},
"pivot:series": {
"value": "Revenue",
"label": "Revenue",
"path": [
"Revenue"
],
"labels": [
"Revenue"
]
}
},
"measures": {
"preview-series-1": 61
}
},
{
"id": "[\"preview-category-4\",\"preview-series-2\"]",
"dimensions": {
"pivot:category": {
"value": "Epsilon",
"label": "Epsilon",
"path": [
"Epsilon"
],
"labels": [
"Epsilon"
]
},
"pivot:series": {
"value": "Volume",
"label": "Volume",
"path": [
"Volume"
],
"labels": [
"Volume"
]
}
},
"measures": {
"preview-series-2": 32
}
}
],
"matrixCells": [
{
"categoryId": "preview-category-0",
"seriesId": "preview-series-0",
"observationId": "[\"preview-category-0\",\"preview-series-0\"]",
"measureFieldId": "preview-series-0"
},
{
"categoryId": "preview-category-0",
"seriesId": "preview-series-1",
"observationId": "[\"preview-category-0\",\"preview-series-1\"]",
"measureFieldId": "preview-series-1"
},
{
"categoryId": "preview-category-0",
"seriesId": "preview-series-2",
"observationId": "[\"preview-category-0\",\"preview-series-2\"]",
"measureFieldId": "preview-series-2"
},
{
"categoryId": "preview-category-1",
"seriesId": "preview-series-0",
"observationId": "[\"preview-category-1\",\"preview-series-0\"]",
"measureFieldId": "preview-series-0"
},
{
"categoryId": "preview-category-1",
"seriesId": "preview-series-1",
"observationId": "[\"preview-category-1\",\"preview-series-1\"]",
"measureFieldId": "preview-series-1"
},
{
"categoryId": "preview-category-1",
"seriesId": "preview-series-2",
"observationId": "[\"preview-category-1\",\"preview-series-2\"]",
"measureFieldId": "preview-series-2"
},
{
"categoryId": "preview-category-2",
"seriesId": "preview-series-0",
"observationId": "[\"preview-category-2\",\"preview-series-0\"]",
"measureFieldId": "preview-series-0"
},
{
"categoryId": "preview-category-2",
"seriesId": "preview-series-1",
"observationId": "[\"preview-category-2\",\"preview-series-1\"]",
"measureFieldId": "preview-series-1"
},
{
"categoryId": "preview-category-2",
"seriesId": "preview-series-2",
"observationId": "[\"preview-category-2\",\"preview-series-2\"]",
"measureFieldId": "preview-series-2"
},
{
"categoryId": "preview-category-3",
"seriesId": "preview-series-0",
"observationId": "[\"preview-category-3\",\"preview-series-0\"]",
"measureFieldId": "preview-series-0"
},
{
"categoryId": "preview-category-3",
"seriesId": "preview-series-1",
"observationId": "[\"preview-category-3\",\"preview-series-1\"]",
"measureFieldId": "preview-series-1"
},
{
"categoryId": "preview-category-3",
"seriesId": "preview-series-2",
"observationId": "[\"preview-category-3\",\"preview-series-2\"]",
"measureFieldId": "preview-series-2"
},
{
"categoryId": "preview-category-4",
"seriesId": "preview-series-0",
"observationId": "[\"preview-category-4\",\"preview-series-0\"]",
"measureFieldId": "preview-series-0"
},
{
"categoryId": "preview-category-4",
"seriesId": "preview-series-1",
"observationId": "[\"preview-category-4\",\"preview-series-1\"]",
"measureFieldId": "preview-series-1"
},
{
"categoryId": "preview-category-4",
"seriesId": "preview-series-2",
"observationId": "[\"preview-category-4\",\"preview-series-2\"]",
"measureFieldId": "preview-series-2"
}
]
}
},
"bindings": {
"x": [
"preview-series-0"
],
"y": [
"preview-series-1"
],
"size": [
"preview-series-2"
]
},
"presentation": {
"dataLabels": false
}
});
// When the host unmounts:
// chart.destroy();

Await updates before reading a snapshot or exporting. Call chart.destroy() when the host unmounts. See the live catalog to interact with this type.

Set these fields in chartOptions. The option schema validates supported keys, ranges and choices; updating chartOptions replaces that authored object.

OptionDefaultAccepted values
showGridLinestruetrue or false
markOpacity10.2 to 1; step 0.05

Bind each group's X/Y measures explicitly. Named X definitions use axes.xAxes and bound Y series select them with seriesOverrides[id].xAxis. Secondary and named Y definitions use axes.ySecondary and axes.yAxes; assign bound Y series with seriesOverrides[id].yAxis. Domains, scales, reversal, ticks, errors and annotations follow the selected Y axis. Navigation and XY source brushing can target primary or named X and primary, secondary or named Y through navigation.xAxis and navigation.yAxis. Synchronization retains its separate compatibility rules and primary-Y limit. See value navigation and XY brushing. See relationship axis options and limits.

Titles, legends, theme and labels belong to presentation or the corresponding top-level setting. Axis, color, navigation and interaction support depends on the selected chart; see Data & Configuration.

  • Scatter — Compare two measures as points across categories.
  • Density scatter — Aggregate dense X/Y observations into spatial density.
  • Connected scatter — Show the ordered path between paired X/Y observations.
  • Quadrant chart — Compare observations across four decision regions.

Charts overview · Installation · Data & Configuration

Missing values, identities and composition

Section titled “Missing values, identities and composition”

Bubble size is a non-negative source measure. A null X, Y or size omits the mark; zero size produces no mark, and negative sizes reject validation. Mark radius is a visual encoding; activation and export retain raw X/Y/size values and the real source category. Independent X/Y assignments belong to the bound Y series, not the size helper. See relationship axes.

To add bubbles to a line/area/column/range composition, use columnLine or areaLine with an explicit bubble layer. This differs from setting the chart’s standalone bindings: see sample-owned layer channels, named axes and complete sources. Bubble is not one of the optional batched SVG/WebGL families.