--- title: "Charts" description: "Data-driven charts from semantic HTML tables using the data-chart attribute vocabulary. Absorbed from Charts.css." type: docs weight: 80 date: 2026-04-09 tags: ["charts", "css", "reference"] ai-disclosure: "generated" ai-model: "claude-sonnet-4-5" ai-provider: "Anthropic" --- ASW includes a chart layer (`06-charts.css`) absorbed from [Charts.css](https://chartscss.org/) (MIT), with the class-based API converted to data-attributes. Charts are pure CSS — no JavaScript, no Canvas, no SVG. The data source is a standard ``. CSS turns it into a chart. --- ## How data binding works Each `` column labels as axis labels. ```html
` carries a `--size` CSS custom property via `style` attribute. This is the **one place** ASW permits inline styles — `style="--size: 0.8"` is data injection (a numeric value binding), not presentational styling. ``` --size: 0.0 → 0% --size: 0.5 → 50% --size: 1.0 → 100% ``` --- ## Bar chart Horizontal bars. Each row is one bar. ```html
Token budget usage
Wake 15%
Research 62%
Output 23%
``` --- ## Column chart Vertical bars. Each `
` is one column. ```html
Sessions per day
Mon Tue Wed Thu Fri
``` --- ## Line chart Connects data points with a line. Requires two `
` values per point: `--start` and `--end`. ```html
Uptime trend
``` --- ## Area chart Like a line chart but with the area beneath filled. ```html
Memory usage
``` --- ## Axis labels Add `data-chart-labels` to show `
Mon Tue Wed
40% 70% 55%
``` --- ## Bar spacing Control gap between bars with `data-chart-spacing="1"` through `"5"` (default is `2`). ```html ...
``` --- ## Stacked charts Multi-dataset mode. Each `` in `` becomes a dataset (one colour per row). ```html
Token usage by phase
``` --- ## Custom colours Override the default colour cycle with `style="--color: ..."` on any ``. ```html Error rate ``` Default colour cycle (8 slots): accent → blue → orange → red → purple → cyan → pink → teal. --- ## Customising chart dimensions Override chart size tokens on the `[data-chart]` element: ```html ``` | Token | Default | Description | |-------|---------|-------------| | `--chart-height` | `200px` | Column chart area height | | `--chart-bar-size` | `2rem` | Column bar width / bar chart bar height | | `--chart-gap` | `6px` | Gap between data points | --- ## Related - [Token System](/docs/tokens/) — colour tokens used by the chart colour cycle (`--accent`, `--accent-blue`, etc.) - [Data Attributes](/docs/data-attributes/) — the broader `data-*` vocabulary of which `data-chart` is a part