Charts
Charts overview
Apache ECharts wrapped by the design system. Pass data only; themes, animation and glass tooltips are automatic.
<script>
import { LineChart } from "@codeatlasdev/ui/charts";
</script>
<LineChart series={[{ name: "Revenue", data: [42, 58, 51, 74] }]} categories={["Jan", "Feb", "Mar", "Apr"]} />
Charts live in the @codeatlasdev/ui/charts subpath and need the optional peer dependency echarts (bun add echarts, version 6). Every chart takes data and a few semantic props. There is no style or font prop on purpose: the palette follows the active preset, axes, legend and tooltips read the --ca-* tokens, and charts re-theme when the color scheme, preset or surface style changes. Series can take an explicit color; use hex or rgb, because ECharts paints on a canvas and cannot parse oklch(). Charts render on the client, so hydrate them with client:visible in Astro.
| Component | Use for |
|---|---|
| LineChart | Trends over time, areas, live streams |
| BarChart | Vertical, horizontal, stacked and grouped bars |
| PieChart | Pie, donut and rose proportions |
| ScatterChart | Correlations and bubble sizing |
| RadarChart | Multi-dimension profiles |
| GaugeChart | KPI gauges and progress rings |
| HeatmapChart | Calendar and matrix density |
| Sparkline | Inline micro charts |
All chart components also accept height (CSS length, each chart has its own default) and class.
Dashboard
Every chart type together inside glass cards.
Revenue
Users
Growth
Uptime
Code
Shared props
| Prop | Type | Default | Description |
|---|---|---|---|
height | string | – | CSS height of the chart. Defaults differ per chart (320px for line, bar and scatter; 300px for pie; 340px for radar; 280px for gauge; 240px for heatmap; 48px for sparkline). |
class | string | '' | Extra class names on the chart container. |