# <chart>

A line, area, bar or sparkline chart drawn from a list of values; a tap shows a point's value.

Category: Display.

```ham
<chart type="line"
       labels="Mon,Tue,Wed,Thu,Fri"
       format="money"
       highlight="last"
       style="text-gray-500">
    <series name="This week"
            data="[1200, 3400, 2800, 4100, 3900]"
            color="blue-600 dark:blue-300"/>
    <series name="Last week"
            data="[900, 2600, 3100, 2900, 3300]"
            color="gray-400"
            dashed/>
</chart>
```

How Hype Apps draws it on a phone: [light](https://hypeapps.dev/img/tags/chart-light.webp), [dark](https://hypeapps.dev/img/tags/chart-dark.webp).

## Attributes

| Name | What it does | Default |
|---|---|---|
| `animate` | When a series' values change, the lines and bars glide from the old values to the new over this many ms. |  |
| `axis` | Y values and x labels (a sparkline: false). Their color is the text color: style="text-gray-500". | `true` |
| `color` | As on <series>. |  |
| `data` | A one-series chart without <series>: as on <series>. |  |
| `format` | How a picked value shows: a format() pattern (money, money:EUR, number:2, percent:1, compact …). |  |
| `grid` | Horizontal grid lines (a sparkline: false). | `true` |
| `height` | Height in px (200; a sparkline 40). The width is the space it is given. |  |
| `highlight` | A point picked from the start: last, an index (0 is the first), or none. Default none (a sparkline: last). |  |
| `in` | As on <series>. |  |
| `label` | As on <series>. |  |
| `labels` | X labels: a JSON array, a comma list (Mon,Tue,Wed), or a $var. A model series can give them with label=. |  |
| `limit` | As on <series>. |  |
| `locale` | Locale for format= (en-US by default). |  |
| `max` | Top of the y axis (default: the data). |  |
| `min` | Bottom of the y axis (default: the data, and 0 for bars). |  |
| `name` | What the chart shows, for screen readers. |  |
| `order` | As on <series>. |  |
| `tap` | false: taps and drags do not pick points. | `true` |
| `type` | area fills under each line; bar groups the series side by side; sparkline is a small line with no axis or grid that marks its last point. (line, area, bar, sparkline) | `line` |
| `value` | As on <series>. |  |
| `where` | As on <series>. |  |

Any tag also takes gestures: `@on.tap`, `@on.longpress`, `@on.doubletap` and `@on.swipeleft` (and right, up and down). `@click` runs on a tap too.

## Related tags

- [`<series>`](https://hypeapps.dev/docs/reference/series.md): One line or set of bars inside a chart, with its own data, name, color and dash.
- [`<ad>`](https://hypeapps.dev/docs/reference/ad.md): An ad slot in the page, filled with a banner from AdMob in a built app.
- [`<avatar>`](https://hypeapps.dev/docs/reference/avatar.md): A round avatar from a photo, initials or an icon, in any size and color.
- [`<badge>`](https://hypeapps.dev/docs/reference/badge.md): A small count or dot pinned to the corner of an icon or any other element.
- [`<canvas-tool>`](https://hypeapps.dev/docs/reference/canvas-tool.md): A drawing tool written in HAM and loaded into a draw pad as a plugin: touch handlers, state and options.
- [`<caption>`](https://hypeapps.dev/docs/reference/caption.md): A table caption, shown as a label above the table.
- [`<carousel>`](https://hypeapps.dev/docs/reference/carousel.md): Swipeable pages side by side, one at a time, with dots below that show which page is on screen.
- [`<countdown>`](https://hypeapps.dev/docs/reference/countdown.md): A timer that counts down to zero in a format you choose and can act when it gets there.

All tags: https://hypeapps.dev/docs/reference.md · The full reference: https://hypeapps.dev/llms.txt
