Cartesian
Bubble
type: 'bubble'Scatter where the marker radius encodes a third value (z), using a square-root scale so area is proportional to z.
Edit the JSON on the right and press Run (or ⌘/Ctrl + Enter) — data, titles, categories and colors all update live.
Live
Bubble
Edit · JSON
Data format
[[x, y, z]] · { x, y, z, name? }
Data shape
The JSON you pass inside the chart — drop it straight into your series.
data: [
[2, 35, 12],
[4, 52, 20],
[8, 75, 34]
]Example
import KatuCharts from 'katucharts.js';
KatuCharts.chart('container', {
chart: { type: 'bubble' },
series: [{ name: 'Teams', data: [[2, 35, 12], [4, 52, 20], [8, 75, 34]] }]
});Type-specific options
| Option | Description |
|---|---|
sizeBy | 'area' (default) or 'width'. |
minSize / maxSize | Bubble size bounds (px or '8%'). |
zMin / zMax / zThreshold | Z-domain bounds and negative threshold. |
displayNegative / sizeByAbsoluteValue | Show negative-z bubbles / size by |z|. |
Variations
Size legend
Show each size as its own reference bubble next to its value (bubbleLegend.layout: 'separate') so readers can decode bubble sizes.
KatuCharts.chart('container', {
chart: { type: 'bubble' },
legend: {
enabled: true, align: 'center', verticalAlign: 'bottom',
bubbleLegend: { enabled: true, layout: 'separate', labels: { format: '{value}' } }
},
series: [{ name: 'Headcount', data: [[2, 35, 12], [4, 52, 20], [8, 75, 34]] }]
});Size legend on the side
Place the separate size bubbles in a vertical legend on the right — the same key also works at the bottom or left.
KatuCharts.chart('container', {
chart: { type: 'bubble' },
legend: {
layout: 'vertical', align: 'right', verticalAlign: 'middle',
bubbleLegend: { enabled: true, layout: 'separate' }
},
series: [{ name: 'Headcount', data: [[2, 35, 12], [4, 52, 20], [8, 75, 34]] }]
});Named & colored bubbles
Color bubbles per point and label each with its name.
KatuCharts.chart('container', {
chart: { type: 'bubble' },
series: [{
colorByPoint: true,
dataLabels: { enabled: true, format: '{point.name}' },
data: [
{ x: 2, y: 35, z: 12, name: 'Alpha' },
{ x: 4, y: 52, z: 20, name: 'Bravo' }
]
}]
});Common errors
- Why does my bubble chart render as a line chart?
- The chart type was not registered. KatuCharts logs "KatuCharts: unknown series type "<type>", falling back to line" and draws a line chart rather than throwing. Import the module the type belongs to — for example `import 'katucharts.js/bio';` — before creating the chart.
- Why do I get "Cannot read properties of null (reading 'appendChild')"?
- The container element does not exist when the chart is created. Create the chart after the element is in the DOM: in React that means inside useEffect, not during render.
- Why is the chart rendering with zero height?
- The container has no height. A div with no content collapses to zero. Give it a height in CSS, or pass `chart: { height: 400 }` in the options.
FAQ
- How do I create a bubble chart in JavaScript?
- Install with `npm install katucharts.js`, then call KatuCharts.chart(container, { chart: { type: 'bubble' }, series: [...] }).
- Why does my bubble chart render as a line chart?
- The chart type was not registered. KatuCharts logs "KatuCharts: unknown series type "<type>", falling back to line" and draws a line chart rather than throwing. Import the module the type belongs to — for example `import 'katucharts.js/bio';` — before creating the chart.
- Why do I get "Cannot read properties of null (reading 'appendChild')"?
- The container element does not exist when the chart is created. Create the chart after the element is in the DOM: in React that means inside useEffect, not during render.
- Why is the chart rendering with zero height?
- The container has no height. A div with no content collapses to zero. Give it a height in CSS, or pass `chart: { height: 400 }` in the options.
Common options (color, visible, marker, dataLabels, animation, events, zones…) apply to every type — see Configuration → series. See it rendered in the gallery.