About
An animated SVG line/area chart that draws its lines left to right on scroll, with a snapping crosshair cursor and one tooltip listing every series' value.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Line Chart to your project and fits it to your theme.
Code
How Line Chart is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
"use client";
import { LineChart } from "@/components/ui/chart-line";
const data = [
{ month: "Jan", revenue: 4200, expenses: 2800 },
{ month: "Feb", revenue: 5100, expenses: 3100 },
{ month: "Mar", revenue: 4800, expenses: 3400 },
{ month: "Apr", revenue: 6200, expenses: 3600 },
{ month: "May", revenue: 7100, expenses: 3900 },
{ month: "Jun", revenue: 6800, expenses: 4100 },
{ month: "Jul", revenue: 7600, expenses: 4300 },
{ month: "Aug", revenue: 8200, expenses: 4500 },
];
export default function LineChartDemo() {
return (
<div className="flex w-full max-w-xl items-center justify-center p-6">
<LineChart
title="Revenue"
data={data}
index="month"
series={[
{ key: "revenue", label: "Revenue" },
{ key: "expenses", label: "Expenses" },
]}
dots
/>
</div>
);
}
















