Area
Area is a graphical series component that renders a filled area under a line on a cartesian chart. It's similar to Line but with fill instead of just a stroke, and supports stacking for combined-area layouts.
import { AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip } from "solid-recharts";
<AreaChart width={500} height={300} data={data}>
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="name" />
<YAxis />
<Tooltip />
<Area type="monotone" dataKey="value" fill="#82ca9d" stroke="#82ca9d" />
</AreaChart>;
Loading source...
Props
| Prop | Type | Default | Description |
|---|---|---|---|
dataKey | string | number | func | — | Data key or accessor for the area's values |
type | string | "linear" | Curve interpolation: "linear", "monotone", etc |
fill | string | "#8884d8" | Fill color |
fillOpacity | number | string | 1 | Fill transparency (0–1) |
stroke | string | — | Line stroke color |
strokeWidth | number | 1 | Line thickness |
connectNulls | boolean | false | Connect data points across null/undefined values |
stackId | string | — | Stack areas with others sharing this id |
baseValue | number | "dataMin" | "dataMax" | 0 | Base value for the area fill (bottom of the fill) |
dot | boolean | object | false | Render dots at each point |
label | boolean | object | false | Render labels at each point |
isAnimationActive | boolean | "auto" | "auto" | Enable enter/update animation |
See the recharts Area docs for the full prop matrix.
Notes
- Stacking: pass the same
stackIdto multipleAreacomponents to stack them (areas with different stack ids overlay). - Range areas: pass a function as
dataKeythat returns[low, high]instead of a single value; the area will span both values. - Fill opacity: use
fillOpacityto control transparency without changing the base color. - Base value: set
baseValueto align the fill to a specific value (e.g.,"dataMin"for the minimum value in the data).