Cartesiano

Burbujas

type: 'bubble'

Dispersión donde el radio del marcador codifica un tercer valor (z), usando una escala de raíz cuadrada para que el área sea proporcional a z.

Edita el JSON a la derecha y presiona Ejecutar (o ⌘/Ctrl + Intro) — los datos, títulos, categorías y colores se actualizan en vivo.

En Vivo
Burbujas
Editar · JSON

Formato de datos

[[x, y, z]] · { x, y, z, name? }

Estructura de datos

El JSON que pasas dentro del gráfico — colócalo directamente en tu series.

data: [
  [2, 35, 12],
  [4, 52, 20],
  [8, 75, 34]
]

Ejemplo

import KatuCharts from 'katucharts.js';

KatuCharts.chart('container', {
  chart: { type: 'bubble' },
  series: [{ name: 'Equipos', data: [[2, 35, 12], [4, 52, 20], [8, 75, 34]] }]
});

Opciones específicas del tipo

OpciónDescripción
sizeBy'area' (predeterminado) o 'width'.
minSize / maxSizeLímites de tamaño de burbuja (px o '8%').
zMin / zMax / zThresholdLímites de dominio Z y umbral negativo.
displayNegative / sizeByAbsoluteValueMostrar burbujas z negativas / tamaño por |z|.

Variaciones

Leyenda de tamaño

Muestra cada tamaño como una burbuja de referencia separada junto a su valor (bubbleLegend.layout: 'separate') para descifrar el tamaño de las burbujas.

KatuCharts.chart('container', {
  chart: { type: 'bubble' },
  legend: {
    enabled: true, align: 'center', verticalAlign: 'bottom',
    bubbleLegend: { enabled: true, layout: 'separate', labels: { format: '{value}' } }
  },
  series: [{ name: 'Plantilla', data: [[2, 35, 12], [4, 52, 20], [8, 75, 34]] }]
});

Leyenda de tamaño lateral

Coloca las burbujas de tamaño separadas en una leyenda vertical a la derecha — la misma clave también funciona abajo o a la izquierda.

KatuCharts.chart('container', {
  chart: { type: 'bubble' },
  legend: {
    layout: 'vertical', align: 'right', verticalAlign: 'middle',
    bubbleLegend: { enabled: true, layout: 'separate' }
  },
  series: [{ name: 'Plantilla', data: [[2, 35, 12], [4, 52, 20], [8, 75, 34]] }]
});

Burbujas con nombre

Colorea las burbujas por punto y etiqueta cada una con su nombre.

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 burbujas 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 burbujas chart in JavaScript?
Install with `npm install katucharts.js`, then call KatuCharts.chart(container, { chart: { type: 'bubble' }, series: [...] }).
Why does my burbujas 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.
Las opciones comunes (color, visible, marker, dataLabels, animation, events, zones…) se aplican a todos los tipos — véase Configuración → series. Míralo renderizado en la galería.