Cartesiano

Columnas

type: 'column'

Gráfico de barras vertical. Compatible con barras agrupadas, apilamiento, colorByPoint, radio de borde y longitud mínima de barra.

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
Columnas
Editar · JSON

Formato de datos

[10, 20, 30] · [{ y: 10, color: '#f00' }]

Estructura de datos

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

series: [
  { name: 'Ventas', data: [42, 55, 67, 81] }
]

Ejemplo

import KatuCharts from 'katucharts.js';

KatuCharts.chart('container', {
  chart: { type: 'column' },
  xAxis: { categories: ['T1', 'T2', 'T3', 'T4'] },
  series: [{ name: 'Ventas', data: [42, 55, 67, 81] }]
});

Opciones específicas del tipo

OpciónDescripción
groupPaddingEspacio entre grupos (predeterminado 0,2).
pointPaddingEspacio entre barras en un grupo (predeterminado 0,1).
borderRadius / borderWidth / borderColorEstilos de borde de barra.
colorByPointCada barra obtiene un color de paleta diferente.
maxPointWidth / pointWidth / minPointLengthLímites de ancho y altura mínima de barra.
stacking / negativeColor'normal' | 'percent' / color para negativos.

Variaciones

Columnas apiladas

Apila las series agrupadas en una sola barra por categoría.

KatuCharts.chart('container', {
  chart: { type: 'column' },
  xAxis: { categories: ['T1', 'T2', 'T3', 'T4'] },
  plotOptions: { column: { stacking: 'normal' } },
  series: [
    { name: 'En Línea', data: [42, 55, 67, 81] },
    { name: 'Minorista', data: [28, 32, 38, 41] },
    { name: 'Partner', data: [12, 18, 22, 30] }
  ]
});

Etiquetas y colorByPoint

Colores por barra con colorByPoint y una etiqueta de valor en cada columna.

KatuCharts.chart('container', {
  chart: { type: 'column' },
  xAxis: { categories: ['T1', 'T2', 'T3', 'T4'] },
  series: [{
    colorByPoint: true, borderRadius: 3,
    dataLabels: { enabled: true, format: '{point.y}' },
    data: [142, 188, 224, 261]
  }]
});

Drilldown

Haz clic en una columna para profundizar en una serie hija; usa la ruta para volver.

KatuCharts.chart('container', {
  chart: { type: 'column' },
  xAxis: { type: 'category' },
  drilldown: {
    series: [
      { id: 'chrome', name: 'Chrome',
        data: [{ name: 'v120', y: 28 }, { name: 'v119', y: 20 }] }
    ]
  },
  series: [{
    colorByPoint: true,
    data: [
      { name: 'Chrome', y: 63, drilldown: 'chrome' },
      { name: 'Safari', y: 18 }
    ]
  }]
});

Common errors

Why does my columnas 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 columnas chart in JavaScript?
Install with `npm install katucharts.js`, then call KatuCharts.chart(container, { chart: { type: 'column' }, series: [...] }).
Why does my columnas 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.