> ## Documentation Index
> Fetch the complete documentation index at: https://prefab.prefect.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# AreaChart

> Visualize volume and trends with filled regions.

AreaChart fills the region between a line and the axis, emphasizing the magnitude of values over time. It supports stacking, which makes it easy to show how parts contribute to a whole. See [Charts](https://prefab.prefect.io/docs/components/charts.md) for the shared data, series, and formatting model.

## Basic Usage

> [card]
>
> ```python Python icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> from prefab_ui.components.charts import AreaChart, ChartSeries
>
> data = [
>     {"month": "Jan", "desktop": 186, "mobile": 80},
>     {"month": "Feb", "desktop": 305, "mobile": 200},
>     {"month": "Mar", "desktop": 237, "mobile": 120},
>     {"month": "Apr", "desktop": 73, "mobile": 190},
>     {"month": "May", "desktop": 209, "mobile": 130},
>     {"month": "Jun", "desktop": 214, "mobile": 140},
> ]
>
> AreaChart(
>     data=data,
>     series=[
>         ChartSeries(data_key="desktop", label="Desktop"),
>         ChartSeries(data_key="mobile", label="Mobile"),
>     ],
>     x_axis="month",
>     show_legend=True,
> )
> ```
>
> ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> {
>   "view": {
>     "type": "AreaChart",
>     "data": [
>       {"month": "Jan", "desktop": 186, "mobile": 80},
>       {"month": "Feb", "desktop": 305, "mobile": 200},
>       {"month": "Mar", "desktop": 237, "mobile": 120},
>       {"month": "Apr", "desktop": 73, "mobile": 190},
>       {"month": "May", "desktop": 209, "mobile": 130},
>       {"month": "Jun", "desktop": 214, "mobile": 140}
>     ],
>     "series": [
>       {"dataKey": "desktop", "label": "Desktop"},
>       {"dataKey": "mobile", "label": "Mobile"}
>     ],
>     "xAxis": "month",
>     "height": 300,
>     "stacked": false,
>     "curve": "linear",
>     "showDots": false,
>     "showLegend": true,
>     "showTooltip": true,
>     "animate": true,
>     "showGrid": true,
>     "showYAxis": true,
>     "valueFormat": "auto"
>   }
> }
> ```

## Stacked

Stacking shows how each series contributes to the total. The topmost line represents the combined value.

> [card]
>
> ```python Python {8} icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> AreaChart(
>     data=data,
>     series=[
>         ChartSeries(data_key="desktop", label="Desktop"),
>         ChartSeries(data_key="mobile", label="Mobile"),
>     ],
>     x_axis="month",
>     stacked=True,
>     show_legend=True,
> )
> ```
>
> ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> {
>   "view": {
>     "type": "AreaChart",
>     "data": [
>       {"month": "Jan", "desktop": 186, "mobile": 80},
>       {"month": "Feb", "desktop": 305, "mobile": 200},
>       {"month": "Mar", "desktop": 237, "mobile": 120},
>       {"month": "Apr", "desktop": 73, "mobile": 190},
>       {"month": "May", "desktop": 209, "mobile": 130},
>       {"month": "Jun", "desktop": 214, "mobile": 140}
>     ],
>     "series": [
>       {"dataKey": "desktop", "label": "Desktop"},
>       {"dataKey": "mobile", "label": "Mobile"}
>     ],
>     "xAxis": "month",
>     "height": 300,
>     "stacked": true,
>     "curve": "linear",
>     "showDots": false,
>     "showLegend": true,
>     "showTooltip": true,
>     "animate": true,
>     "showGrid": true,
>     "showYAxis": true,
>     "valueFormat": "auto"
>   }
> }
> ```

## Minimal

Set `show_grid=False` to drop the background gridlines. Without them the filled area reads as a single glanceable shape — a good fit for compact trend cards where the silhouette matters more than reading exact values off an axis.

> [card]
>
> ```python Python {5} icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> AreaChart(
>     data=data,
>     series=[ChartSeries(data_key="desktop", label="Desktop")],
>     x_axis="month",
>     show_grid=False,
> )
> ```
>
> ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> {
>   "view": {
>     "type": "AreaChart",
>     "data": [
>       {"month": "Jan", "desktop": 186, "mobile": 80},
>       {"month": "Feb", "desktop": 305, "mobile": 200},
>       {"month": "Mar", "desktop": 237, "mobile": 120},
>       {"month": "Apr", "desktop": 73, "mobile": 190},
>       {"month": "May", "desktop": 209, "mobile": 130},
>       {"month": "Jun", "desktop": 214, "mobile": 140}
>     ],
>     "series": [{"dataKey": "desktop", "label": "Desktop"}],
>     "xAxis": "month",
>     "height": 300,
>     "stacked": false,
>     "curve": "linear",
>     "showDots": false,
>     "showLegend": true,
>     "showTooltip": true,
>     "animate": true,
>     "showGrid": false,
>     "showYAxis": true,
>     "valueFormat": "auto"
>   }
> }
> ```

## Smooth

Set `curve="smooth"` for gently curved lines between data points. The filled area follows the curve.

> [card]
>
> ```python Python {8} icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> AreaChart(
>     data=data,
>     series=[
>         ChartSeries(data_key="desktop", label="Desktop"),
>         ChartSeries(data_key="mobile", label="Mobile"),
>     ],
>     x_axis="month",
>     curve="smooth",
>     show_legend=True,
> )
> ```
>
> ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> {
>   "view": {
>     "type": "AreaChart",
>     "data": [
>       {"month": "Jan", "desktop": 186, "mobile": 80},
>       {"month": "Feb", "desktop": 305, "mobile": 200},
>       {"month": "Mar", "desktop": 237, "mobile": 120},
>       {"month": "Apr", "desktop": 73, "mobile": 190},
>       {"month": "May", "desktop": 209, "mobile": 130},
>       {"month": "Jun", "desktop": 214, "mobile": 140}
>     ],
>     "series": [
>       {"dataKey": "desktop", "label": "Desktop"},
>       {"dataKey": "mobile", "label": "Mobile"}
>     ],
>     "xAxis": "month",
>     "height": 300,
>     "stacked": false,
>     "curve": "smooth",
>     "showDots": false,
>     "showLegend": true,
>     "showTooltip": true,
>     "animate": true,
>     "showGrid": true,
>     "showYAxis": true,
>     "valueFormat": "auto"
>   }
> }
> ```

## Step

Set `curve="step"` to connect points with step-shaped lines. The filled area follows the stepped edges.

> [card]
>
> ```python Python {8} icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> AreaChart(
>     data=data,
>     series=[
>         ChartSeries(data_key="desktop", label="Desktop"),
>         ChartSeries(data_key="mobile", label="Mobile"),
>     ],
>     x_axis="month",
>     curve="step",
>     show_legend=True,
> )
> ```
>
> ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> {
>   "view": {
>     "type": "AreaChart",
>     "data": [
>       {"month": "Jan", "desktop": 186, "mobile": 80},
>       {"month": "Feb", "desktop": 305, "mobile": 200},
>       {"month": "Mar", "desktop": 237, "mobile": 120},
>       {"month": "Apr", "desktop": 73, "mobile": 190},
>       {"month": "May", "desktop": 209, "mobile": 130},
>       {"month": "Jun", "desktop": 214, "mobile": 140}
>     ],
>     "series": [
>       {"dataKey": "desktop", "label": "Desktop"},
>       {"dataKey": "mobile", "label": "Mobile"}
>     ],
>     "xAxis": "month",
>     "height": 300,
>     "stacked": false,
>     "curve": "step",
>     "showDots": false,
>     "showLegend": true,
>     "showTooltip": true,
>     "animate": true,
>     "showGrid": true,
>     "showYAxis": true,
>     "valueFormat": "auto"
>   }
> }
> ```

## Value Formatting

Use `value_format` to format numeric values on the value axis and in tooltips. It accepts the same pipe strings as Prefab expressions and data table columns, including `currency`, `currency:EUR`, `percent:1`, and `compact:0`.

> [card]
>
> ```python icon="python" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> from prefab_ui.components.charts import AreaChart, ChartSeries
>
> data = [
>     {"month": "Jan", "hosting": 34_000, "storage": 12_000},
>     {"month": "Feb", "hosting": 41_000, "storage": 13_500},
>     {"month": "Mar", "hosting": 46_000, "storage": 15_000},
>     {"month": "Apr", "hosting": 52_000, "storage": 16_500},
> ]
>
> AreaChart(
>     data=data,
>     series=[
>         ChartSeries(data_key="hosting", label="Hosting"),
>         ChartSeries(data_key="storage", label="Storage"),
>     ],
>     x_axis="month",
>     stacked=True,
>     value_format="currency",
>     show_legend=True,
> )
> ```
>
> ```json Protocol icon="brackets-curly" theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
> {
>   "view": {
>     "type": "AreaChart",
>     "data": [
>       {"month": "Jan", "hosting": 34000, "storage": 12000},
>       {"month": "Feb", "hosting": 41000, "storage": 13500},
>       {"month": "Mar", "hosting": 46000, "storage": 15000},
>       {"month": "Apr", "hosting": 52000, "storage": 16500}
>     ],
>     "series": [
>       {"dataKey": "hosting", "label": "Hosting"},
>       {"dataKey": "storage", "label": "Storage"}
>     ],
>     "xAxis": "month",
>     "height": 300,
>     "stacked": true,
>     "curve": "linear",
>     "showDots": false,
>     "showLegend": true,
>     "showTooltip": true,
>     "animate": true,
>     "showGrid": true,
>     "showYAxis": true,
>     "valueFormat": "currency"
>   }
> }
> ```

## API Reference

> [card] AreaChart Parameters
>
> **data** `list[dict] | str` *required*
>
> Data as a list of dicts, or a `{{ field }}` interpolation reference.
>
> **series** `list[ChartSeries]` *required*
>
> Series definitions — each becomes a filled area on the chart.
>
> **x\_axis** `str | None` (default: None)
>
> Data key for x-axis labels.
>
> **height** `int` (default: 300)
>
> Chart height in pixels.
>
> **stacked** `bool` (default: False)
>
> Stack areas on top of each other.
>
> **curve** `Literal["linear", "smooth", "step"]` (default: "linear")
>
> Interpolation curve between data points.
>
> **show\_dots** `bool` (default: False)
>
> Show a dot at each data point.
>
> **show\_legend** `bool` (default: False)
>
> Show a legend below the chart.
>
> **show\_tooltip** `bool` (default: True)
>
> Show tooltips on hover.
>
> **show\_grid** `bool` (default: True)
>
> Show horizontal grid lines.
>
> **show\_y\_axis** `bool` (default: True)
>
> Show the y-axis with its tick labels. Set to `False` for a compact, axis-free reading where the shape matters more than exact values.
>
> **value\_format** `str` (default: "auto")
>
> Format value-axis ticks and tooltip values with an expression pipe such as `currency`, `currency:EUR`, `percent:1`, or `compact:0`.
>
> **css\_class** `str | None` (default: None)
>
> Additional Tailwind CSS classes.

> [card] ChartSeries Parameters
>
> **data\_key** `str` *required*
>
> Data field to plot — must match a key in the data dicts.
>
> **label** `str | None` (default: None)
>
> Display label for legends and tooltips. Defaults to the `data_key` value.
>
> **color** `str | None` (default: None)
>
> CSS color override. By default, colors cycle through the theme's chart palette (`--chart-1` through `--chart-5`).

## Protocol Reference

```json AreaChart theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
{
  "type": "AreaChart",
  "id?": "string",
  "onMount?": "any",
  "data": "object[] | string (required)",
  "series": "[ChartSeries] (required)",
  "xAxis?": "string",
  "height?": "300",
  "stacked?": false,
  "curve?": "linear | smooth | step",
  "showDots?": false,
  "showLegend?": true,
  "showTooltip?": true,
  "animate?": true,
  "showGrid?": true,
  "showYAxis?": true,
  "valueFormat?": "string",
  "cssClass?": "string"
}
```

```json ChartSeries theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
{
  "dataKey": "string (required)",
  "label?": "string",
  "color?": "string"
}
```

For the complete protocol schema, see [AreaChart](https://prefab.prefect.io/docs/protocol/area-chart.md), [ChartSeries](https://prefab.prefect.io/docs/protocol/chart-series.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.