Chart

Bars, lines, area and stacked bars in custom SVG, on a single axis. Tooltip on pointer and keyboard arrows, legend, end-of-line label and the same numbers in a table. House colors tuned and validated for color blindness. No chart library.

Receita e custosAbril a setembro de 2026, em reais
  • Receita
  • Despesa
Use the left and right arrow keys to read each point, or the View table button.

Settings

Tipo
Séries
Toggles

Examples

Stacked: the whole and its parts

Pedidos por canalÚltima semana
  • Site
  • App
  • Balcão
Use the left and right arrow keys to read each point, or the View table button.

One series, many points

Visitas por horaMédia dos últimos 30 dias
Use the left and right arrow keys to read each point, or the View table button.

Fixed color per entity

Despesa x marketing
  • Despesa
  • Marketing
Use the left and right arrow keys to read each point, or the View table button.

One series, no grid

Chamados abertos por semana
Use the left and right arrow keys to read each point, or the View table button.

Installation

The command creates components/ui/chart.tsx in your project and installs the theme with it. The file is yours: edit it as you like.

npx @ravox-ui/cli add chart

Props

PropTypeDefaultDescription
type"bar" | "line" | "area" | "stacked""bar"Bars compare categories; lines and area show time; stacked shows the whole and its parts.
dataT[]—One item per point on the X axis, with the numbers for each series: { mes: "jan", receita: 48200 }.
xkeyof T—The key of the X axis label (e.g. "mes").
series{ key, label, color? }[]—Up to 4. Without color, they follow the order blue, yellow, pink, lime (the color stays with the series, not the position).
titlestring—Visible title; also names the chart for screen readers.
descriptionstring—Supporting line below the title (period, unit).
xLabelstring—Name of the X column in the table (e.g. "Month").
heightnumber240Height of the chart area with the axes, in px. The width follows the available space.
format(v: number) => string—Values in the tooltip, the table and at the end of the line (e.g. currency).
formatAxis(v: number) => stringcompactY axis numbers. Default: 1.2k, 3.4M.
legendbooleantrue com 2+ sériesLegend below the title. With a single series, the title already says what it is.
gridbooleantrueHorizontal grid lines (the zero line is always there).
endLabelbooleantrueLines and area: the last value next to the end of the line. Disappears on its own when labels overlap.
tableTogglebooleantrue"View table" button: the same numbers in a Table.
--grafico-azul · -amarelo · -rosa · -limaCSS—Change the series colors in your CSS. The defaults are steps of the mosaic colors tuned for charts, validated for color blindness and with 3:1 contrast on the card in light and dark themes.

More in Data