Area Chart
Documentation Index
Fetch the complete documentation index at: /llms.txt. Use this file to discover all available pages before exploring further.
Simple static & beautifully designed area charts
Installation
Usage
The area chart is composible. <EvilAreaChart> is the container, and you compose only the parts you need — <Grid>, <XAxis>, <YAxis>, <Legend>, <Tooltip>, and one or more <Area> — as its children. Each <Area> carries its own variant, strokeVariant, and isClickable, so a single chart can mix fill styles, stroke styles, and make only some series interactive.
import {
EvilAreaChart,
Area,
XAxis,
YAxis,
Grid,
Tooltip,
Legend,
Dot,
ActiveDot,
} from "@/components/evilcharts/charts/area-chart";<EvilAreaChart data={data} config={chartConfig} stackType="stacked">
<Grid />
<XAxis dataKey="month" />
<YAxis />
<Legend isClickable />
<Tooltip />
<Area dataKey="desktop" variant="gradient" strokeVariant="dashed" isClickable>
<Dot variant="border" />
<ActiveDot variant="colored-border" />
</Area>
<Area dataKey="mobile" variant="hatched" strokeVariant="solid" isClickable>
<ActiveDot variant="colored-border" />
</Area>
</EvilAreaChart>Interactive Selection
Add isClickable to any <Area> (and to <Legend>) to make those series selectable. Use the onSelectionChange callback on <EvilAreaChart> to handle selection events:
<EvilAreaChart
data={data}
config={chartConfig}
onSelectionChange={(selectedDataKey) => {
if (selectedDataKey) {
console.log("Selected:", selectedDataKey);
} else {
console.log("Deselected");
}
}}
>
<XAxis dataKey="month" />
<Legend isClickable />
<Tooltip />
<Area dataKey="desktop" variant="gradient" isClickable />
<Area dataKey="mobile" variant="gradient" isClickable />
</EvilAreaChart>Loading State
The area chart supports loading state. You can pass the isLoading prop to the chart to show the loading state. You can also pass curveType to customize the curve type of the loading state. Here, im using curveType='bump' to make the loading state more realistic.
Examples
Below are some examples of the area chart with different variants. where you can change the stackType, curveType, strokeVariant & areaVariant.
Gradient Colors
Curve Types
Stack Types
Stroke Variants
Area Variants
API Reference
The chart is composed of several parts. The props below are grouped by the component they belong to.
The root container. It owns the data, the shared selection state, the loading skeleton, and the optional brush. Everything visual is composed as its children.
A single area series. Each <Area /> is self-contained and generates its own gradient/pattern definitions, so a chart can hold any number of areas — each with its own variant, stroke, and clickability.
Point markers composed inside an <Area />. <Dot /> is the resting marker; <ActiveDot /> is the hovered marker. They render nothing on their own — the parent <Area /> reads their variant.
The category and value axes. Both ship with the chart's flat default styling and forward every Recharts axis prop, so dataKey, tickFormatter, tickMargin, etc. pass straight through. They are hidden automatically while the chart is loading, and <YAxis /> formats ticks as percentages when stackType="expanded".
The background grid lines. Defaults to horizontal-only dashed lines and forwards every Recharts CartesianGrid prop.
The hover tooltip. It reads the chart's selection state so its content dims unselected series.
The series legend. When isClickable is set, each entry toggles selection of its series.