Line Chart
Documentation Index
Fetch the complete documentation index at: /llms.txt. Use this file to discover all available pages before exploring further.
Beautifully designed static line charts
Installation
Usage
The line chart is composible. <EvilLineChart> is the container, and every part hangs off it as a compound member — <EvilLineChart.Grid>, <EvilLineChart.XAxis>, <EvilLineChart.YAxis>, <EvilLineChart.Legend>, <EvilLineChart.Tooltip>, and one or more <EvilLineChart.Line> — as children. Each <Line> sets its own strokeVariant, curveType, glowing, enableBufferLine, and isClickable, so one chart can mix stroke styles and make only some series interactive.
import { EvilLineChart } from "@/components/evilcharts/charts/recharts-line-chart";
import { type ChartConfig } from "@/components/evilcharts/ui/recharts-chart";<EvilLineChart data={data} config={chartConfig} curveType="monotone">
<EvilLineChart.Grid />
<EvilLineChart.XAxis dataKey="month" />
<EvilLineChart.YAxis />
<EvilLineChart.Legend isClickable />
<EvilLineChart.Tooltip />
<EvilLineChart.Line dataKey="desktop" strokeVariant="solid" isClickable>
<EvilLineChart.Dot variant="border" />
<EvilLineChart.ActiveDot variant="colored-border" />
</EvilLineChart.Line>
<EvilLineChart.Line dataKey="mobile" strokeVariant="dashed" glowing>
<EvilLineChart.ActiveDot variant="default" />
</EvilLineChart.Line>
</EvilLineChart>Interactive Selection
Add isClickable to any <Line> (or <Legend>) to make its series selectable, then handle events with the onSelectionChange callback on <EvilLineChart>:
<EvilLineChart
data={data}
config={chartConfig}
onSelectionChange={(selectedDataKey) => {
if (selectedDataKey) {
console.log("Selected:", selectedDataKey);
} else {
console.log("Deselected");
}
}}
>
<EvilLineChart.XAxis dataKey="month" />
<EvilLineChart.Legend isClickable />
<EvilLineChart.Tooltip />
<EvilLineChart.Line dataKey="desktop" strokeVariant="solid" isClickable />
<EvilLineChart.Line dataKey="mobile" strokeVariant="solid" isClickable />
</EvilLineChart>Loading State
Pass isLoading to show the loading skeleton, and curveType to shape its curve. Here, curveType='bump' makes it look more realistic.
Buffer Line
With enableBufferLine, each line's last segment renders as a dashed pattern while the rest stays solid — ideal for flagging projected, estimated, or incomplete data, as seen in financial and forecasting charts.
Examples
Examples with different variants — change the curveType and strokeVariant.
Gradient Colors
Curve Types
Stroke Variants
Glowing Lines
API Reference
Props below are grouped by the component they belong to.
The root container. It owns the data, selection state, loading skeleton, and optional brush; everything visual is composed as children.
A single line series. Each <Line /> generates its own gradient and glow definitions, so a chart can hold any number — each with its own stroke, glow, and clickability.
Point markers composed inside a <Line />. <Dot /> is the resting marker, <ActiveDot /> the hovered one. They render nothing themselves — the parent <Line /> reads their variant.
The category and value axes. Both use the chart's flat default styling and forward every Recharts axis prop, so dataKey, tickFormatter, tickMargin, etc. pass through. They hide automatically while the chart loads.
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 the chart is clickable, each entry toggles selection of its series.
An optional zoom brush below the chart. Include <EvilLineChart.Brush /> to render it; dragging the range filters the main chart.