Composed Chart
Documentation Index
Fetch the complete documentation index at: /llms.txt. Use this file to discover all available pages before exploring further.
Static, beautifully designed composed charts combining bars and lines
Installation
Usage
<EvilComposedChart> is the container; compose the parts you need — <EvilComposedChart.Grid>, <EvilComposedChart.XAxis>, <EvilComposedChart.YAxis>, <EvilComposedChart.Legend>, <EvilComposedChart.Tooltip>, and one or more <EvilComposedChart.Bar> and <EvilComposedChart.Line> — as children. Each <Bar> carries its own variant, glow, and isClickable; each <Line> its own strokeVariant, curveType, glow, and isClickable, so one chart can mix bar and line styles freely.
import { EvilComposedChart } from "@/components/evilcharts/charts/recharts-composed-chart";
import { type ChartConfig } from "@/components/evilcharts/ui/recharts-chart";const chartConfig = {
revenue: {
label: "Revenue",
colors: { light: ["#3b82f6"], dark: ["#6A5ACD"] },
},
profit: {
label: "Profit",
colors: { light: ["#10b981"], dark: ["#34d399"] },
},
} satisfies ChartConfig;
<EvilComposedChart xDataKey="month" data={data} config={chartConfig}>
<EvilComposedChart.Grid />
<EvilComposedChart.XAxis dataKey="month" />
<EvilComposedChart.YAxis />
<EvilComposedChart.Legend isClickable />
<EvilComposedChart.Tooltip />
<EvilComposedChart.Bar dataKey="revenue" variant="gradient" isClickable />
<EvilComposedChart.Line dataKey="profit" strokeVariant="dashed" isClickable>
<EvilComposedChart.Dot variant="default" />
<EvilComposedChart.ActiveDot variant="colored-border" />
</EvilComposedChart.Line>
</EvilComposedChart>Interactive Selection
Add isClickable to any <Bar>, <Line>, or <Legend> to make those series selectable. Handle selection with the onSelectionChange callback on <EvilComposedChart>:
<EvilComposedChart
data={data}
config={chartConfig}
onSelectionChange={(selectedDataKey) => {
if (selectedDataKey) {
console.log("Selected:", selectedDataKey);
} else {
console.log("Deselected");
}
}}
>
<EvilComposedChart.XAxis dataKey="month" />
<EvilComposedChart.Legend isClickable />
<EvilComposedChart.Tooltip />
<EvilComposedChart.Bar dataKey="revenue" isClickable />
<EvilComposedChart.Line dataKey="profit" isClickable />
</EvilComposedChart>Loading State
Pass the isLoading prop to show a shimmer skeleton while your data is being fetched.
Examples
Customize each <Bar> with a variant, and each <Line> with a strokeVariant, curveType, and more.
Gradient Colors
Bar Variants
Line Stroke Variants
Curve Types
Line Dots
Compose a <Dot> for the resting marker and an <ActiveDot> for the hover marker inside a <Line>. Variants: default, border, colored-border.
Hover Highlight
Set enableHoverHighlight on a <Bar> to dim the other bars on hover, keeping focus on specific data points.
Glowing Effects
Add the glow prop to a <Bar> or <Line> for a subtle glow. Each glowing series renders its own scoped filter.
API Reference
The props below are grouped by the component they belong to.
The root container. It owns the data, shared selection state, loading skeleton, and optional brush; everything visual is composed as its children.
A single bar series. Each <Bar /> generates its own gradient/pattern definitions, so a chart can hold any number of bars — each with its own variant, glow, and clickability.
A single line series. Each <Line /> generates its own color gradient and glow filter, so a chart can hold any number of lines — each with its own stroke, curve, glow, and clickability.
Point markers composed inside a <Line />. <Dot /> is the resting marker; <ActiveDot /> is the hovered marker. They render nothing on their own — the parent <Line /> reads their variant.
The category and value axes. Both ship with the chart's flat default styling and forward every Recharts axis prop — dataKey, tickFormatter, tickMargin, etc. pass straight through. They hide automatically while the chart is loading.
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.
An optional zoom brush below the chart. Include <EvilComposedChart.Brush /> to render it; dragging the range filters the main chart.