Cartesiano

Colunas

type: 'column'

Gráfico de barras vertical. Suporta barras agrupadas, empilhamento, colorByPoint, raio de borda e comprimento mínimo de barra.

Edite o JSON à direita e pressione Executar (ou ⌘/Ctrl + Enter) — dados, títulos, categorias e cores se atualizam ao vivo.

Ao Vivo
Colunas
Editar · JSON

Formato de dados

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

Estrutura de dados

O JSON que você passa dentro do gráfico — coloque direto na sua series.

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

Exemplo

import KatuCharts from 'katucharts.js';

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

Opções específicas do tipo

OpçãoDescrição
groupPaddingEspaço entre grupos (padrão 0.2).
pointPaddingEspaço entre barras em um grupo (padrão 0.1).
borderRadius / borderWidth / borderColorEstilo de borda da barra.
colorByPointCada barra recebe uma cor diferente da paleta.
maxPointWidth / pointWidth / minPointLengthLimites de largura e altura mínima da barra.
stacking / negativeColor'normal' | 'percent' / cor para negativos.

Variações

Colunas empilhadas

Empilhe as séries agrupadas em uma única barra por categoria.

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

Rótulos e colorByPoint

Cores por barra com colorByPoint e um rótulo de valor em cada coluna.

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]
  }]
});

Drill-down

Clique em uma coluna para detalhar uma série filha; use a trilha para voltar.

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