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
Reference #193 · Pick in the gallery
Code
Horizontal bars
Good for long category names and rankings.
Reference #190 · Pick in the gallery
Code
Stacked bars
Reference #191 · Pick in the gallery
Code
Grouped and stacked
Toggling stacked animates between both layouts.
Reference #192 · Pick in the gallery
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. |