--- title: "Chart Story" description: "One chart builds from data in reading order and lands the exact supplied values: staggered bars, a left-to-right line with area fill, a sweeping donut, or filling progress bars, with an accented value callout on the emphasized datum." --- import { InstallCommand } from "/snippets/install-command.jsx"; import { VariablesExplorer } from "/snippets/variables-explorer.jsx"; ```html chart-story.html Chart Story ``` ## Install That writes one file: `compositions/components/chart-story.html`. ## Paste it into your composition Open `compositions/components/chart-story.html` and copy what is inside into your own composition. A component has no size or duration of its own. It takes both from the composition you paste it into. ## Variables Every one of these has a default, so the piece works untouched. Set the ones you want to change on the element: | Variable | Default | Accepts | What it does | | --- | --- | --- | --- | | `type` | `bars` | `bars`, `line`, `donut`, `progress` | Chart form the data builds into. | | `data` | `12, 28, 45, 64` | string | Comma-separated numbers; the chart lands exactly on these values. | | `labels` | `Q1, Q2, Q3, Q4` | string | Comma-separated labels, one per datum. | | `emphasize` | `3` | number | Index of the datum that takes the accent and the value callout. Clamped to the data range. | | `unit` | `%` | string | Suffix appended to every displayed value. | | `accent` | `green` | `green`, `blue`, `violet` | Contract color used by the emphasized datum and its callout. | | `exit` | `none` | `none`, `fade`, `up` | Optional departure. Proof stats end on the still hold, so the default is none. | Set them with `data-variable-values` on the element that mounts it. These are the defaults, so this behaves exactly like the preview above until you change one: ```html wrap
``` ## Source ```html Chart Story ``` {/* hf:generated-footer */} Tagged `motion-primitive` `proof` `stats` `chart` `bars` `line` `donut` `progress` `deterministic`. ## Related topics - [Browse the complete Catalog](/catalog) - [Add assets and Catalog items in Studio](/studio/assets-and-blocks) - [Build a richer composition](/go-further)