Cartesiano
Bolhas
type: 'bubble'Dispersão onde o raio do marcador codifica um terceiro valor (z), usando uma escala de raiz quadrada para que a área seja proporcional a z.
Edite o JSON à direita e pressione Executar (ou ⌘/Ctrl + Enter) — dados, títulos, categorias e cores se atualizam ao vivo.
Ao Vivo
Bolhas
Editar · JSON
Formato de dados
[[x, y, z]] · { x, y, z, name? }
Estrutura de dados
O JSON que você passa dentro do gráfico — coloque direto na sua series.
data: [
[2, 35, 12],
[4, 52, 20],
[8, 75, 34]
]Exemplo
import KatuCharts from 'katucharts.js';
KatuCharts.chart('container', {
chart: { type: 'bubble' },
series: [{ name: 'Equipes', data: [[2, 35, 12], [4, 52, 20], [8, 75, 34]] }]
});Opções específicas do tipo
| Opção | Descrição |
|---|---|
sizeBy | 'area' (padrão) ou 'width'. |
minSize / maxSize | Limites de tamanho de bolha (px ou '8%'). |
zMin / zMax / zThreshold | Limites do domínio Z e limite negativo. |
displayNegative / sizeByAbsoluteValue | Mostre bolhas com z negativo / dimensione por |z|. |
Variações
Legenda de tamanho
Mostre cada tamanho como uma bolha de referência separada ao lado do seu valor (bubbleLegend.layout: 'separate') para decodificar o tamanho das bolhas.
KatuCharts.chart('container', {
chart: { type: 'bubble' },
legend: {
enabled: true, align: 'center', verticalAlign: 'bottom',
bubbleLegend: { enabled: true, layout: 'separate', labels: { format: '{value}' } }
},
series: [{ name: 'Quadro de Pessoal', data: [[2, 35, 12], [4, 52, 20], [8, 75, 34]] }]
});Legenda de tamanho lateral
Coloque as bolhas de tamanho separadas em uma legenda vertical à direita — a mesma chave também funciona embaixo ou à esquerda.
KatuCharts.chart('container', {
chart: { type: 'bubble' },
legend: {
layout: 'vertical', align: 'right', verticalAlign: 'middle',
bubbleLegend: { enabled: true, layout: 'separate' }
},
series: [{ name: 'Quadro de Pessoal', data: [[2, 35, 12], [4, 52, 20], [8, 75, 34]] }]
});Bolhas nomeadas
Colora as bolhas por ponto e rotule cada uma com seu nome.
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 bolhas 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 bolhas chart in JavaScript?
- Install with `npm install katucharts.js`, then call KatuCharts.chart(container, { chart: { type: 'bubble' }, series: [...] }).
- Why does my bolhas 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.
Opções comuns (color, visible, marker, dataLabels, animation, events, zones…) se aplicam a cada tipo — veja Configuração → series. Veja renderizado na galeria.