Chart
Use Chart.js with A3S UI defaults for themed colors, external tooltips, and optional generated legends.
Usage
Include CSS
Import Tailwind and one full A3S UI style bundle.
Or import only the base CSS, Chart component CSS, and one style pack.
Using CDN or bundler imports? See the Installation page.
Include JavaScript
Copy or serve Chart.js, the A3S UI runtime, and Chart script.
Chart is not included in the full A3S UI JavaScript bundle.
Using CDN or bundler imports? See the Installation page.
Add your chart HTML
a3sUI.chart() targets the <canvas> directly and creates A3S UI's internal .chart container for Chart.js sizing. You do not need to add a wrapper or class in your HTML.
Charts default to aspect-video. Use a height, min-h-*, or aspect-* utility on a parent element when you need a different measuring box.
Legend
Set legend: true to generate a A3S UI-styled legend after the canvas.
The generated legend is display-only by default, matching shadcn/ui. Use a Chart.js plugin or custom legend markup if you need click-to-toggle behavior.
Series
series maps object keys from each data row to labels, colors, and optional Chart.js dataset settings.
Escape Hatches
Pass raw Chart.js options and plugins through options and plugins.
Pass complete Chart.js data through chartData when the simplified data plus series mapper is not enough.
a3sUI.chart() returns the Chart.js instance for single targets and an array of instances for multi-target selectors.