Charts
BarChart
Vertical, horizontal, stacked and grouped bars.
<script>
import { BarChart } from "@codeatlasdev/ui/charts";
</script>
<BarChart series={[{ name: "Revenue", data: [38400, 54200, 71600, 89800] }]} categories={["Q1", "Q2", "Q3", "Q4"]} />
Multiple series render grouped by default. Set stacked to stack them into one column per category.
Vertical bars
Code
Horizontal bars
Good for long category names and rankings.
Code
Stacked bars
Code
Grouped and stacked
Toggling stacked animates between both layouts.
Code
Props
| Prop | Type | Default | Description |
|---|---|---|---|
series | ChartSeries[] | – | Named series sharing one category axis. Each is { name, data: number[], color? }. |
categories | string[] | – | Category labels, one per bar group. |
valueFormatter | (value: number) => string | – | Formats value-axis ticks and tooltip values. |
horizontal | boolean | false | Renders bars horizontally. |
stacked | boolean | false | Stacks all series into one column per category. |
height | string | '320px' | CSS height of the chart. |
class | string | '' | Extra class names. |