Cartesiano

Área

type: 'area'

Área preenchida sob uma linha. Suporta empilhamento normal e percentual, cor de preenchimento negativo e rastreamento de área ao passar o mouse.

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

Ao Vivo
Área
Editar · JSON

Formato de dados

igual a linha

Estrutura de dados

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

series: [
  { name: 'Free', data: [120, 260, 410, 600] }
]

Exemplo

import KatuCharts from 'katucharts.js';

KatuCharts.chart('container', {
  chart: { type: 'area' },
  series: [{ name: 'Free', data: [120, 260, 410, 600], fillOpacity: 0.3 }]
});

Opções específicas do tipo

OpçãoDescrição
fillOpacityOpacidade do preenchimento da área (padrão 0.75).
fillColorSobreescreva a cor de preenchimento.
negativeFillColorPreencha abaixo do limite.
stacking'normal' ou 'percent'.
trackByAreaPassar o mouse ativa na área, não apenas na linha.

Variações

Empilhamento percentual

Empilhe as séries em 100% para comparar a composição ao longo do tempo.

KatuCharts.chart('container', {
  chart: { type: 'area' },
  plotOptions: { area: { stacking: 'percent' } },
  series: [
    { name: 'Computador', data: [450, 520, 480, 610, 580] },
    { name: 'Celular', data: [280, 350, 420, 510, 620] }
  ]
});

Preenchimento por limite negativo

Preencha abaixo de um limite com um negativeColor separado.

KatuCharts.chart('container', {
  chart: { type: 'area' },
  series: [{
    data: [-12, -6, 4, 10, -3, 14, 22, 18],
    threshold: 0,
    negativeColor: '#B43417'
  }]
});

Preenchimento gradiente

Esmaece o preenchimento da área com um linearGradient vertical passado em fillColor.

KatuCharts.chart('container', {
  chart: { type: 'area' },
  series: [{
    name: 'Usuários',
    data: [320, 410, 380, 520, 610, 700, 540],
    fillColor: {
      linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
      stops: [[0, 'rgba(45,133,116,0.4)'], [1, 'rgba(45,133,116,0)']]
    }
  }]
});

Common errors

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