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). Every chart takes data and a few semantic props. There are no color, font or style props on purpose: the palette follows the active preset, tooltips use the glass material, and charts re-theme when the color scheme, preset or surface style changes. Chart components 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
$118k
↑+23.4%Users
94.2k
↑+8.1%Growth
34%
↑+5.6%Uptime
99.9%
↑+0.1%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. |