Loading...
Loading...
> A multi-series line chart built with Recharts. Supports multiple data series, tooltips, legends, and customizable styling.
1import { LineChart, LineChartCard } from "@/components/ui/line-chart"
1<LineChart2 data={data}3 xAxisKey="month"4 series={[5 { dataKey: "revenue", name: "Revenue", color: "var(--color-primary)" },6 { dataKey: "users", name: "Users", color: "var(--color-accent)" },7 ]}8 height={300}9 showLegend={true}10/>
Monthly revenue trend
1<LineChartCard2 title="Revenue Analytics"3 description="Monthly revenue trend"4 code="0x01"5 icon={<TrendingUp className="h-4 w-4 text-primary" />}6 data={data}7 xAxisKey="month"8 series={[{ dataKey: "revenue", name: "Revenue" }]}9/>
1<LineChart2 data={data}3 xAxisKey="month"4 series={[{ dataKey: "revenue", name: "Revenue", showDots: true }]}5 height={200}6/>
1<LineChart2 data={data}3 xAxisKey="month"4 series={[5 { dataKey: "revenue", name: "Revenue" },6 { dataKey: "users", name: "Users (Projected)", dashed: true },7 ]}8/>
| Prop | Type | Default | Description |
|---|---|---|---|
| data* | LineChartDataPoint[] | - | Chart data array. |
| xAxisKey* | string | - | Data key for X-axis. |
| series* | LineChartSeries[] | - | Line series configuration. |
| height | number | 300 | Chart height in pixels. |
| showGrid | boolean | true | Show grid lines. |
| showLegend | boolean | false | Show legend. |
| showTooltip | boolean | true | Show tooltip on hover. |
| yAxisFormatter | (value: number) => string | - | Y-axis value formatter. |
| xAxisFormatter | (value: string) => string | - | X-axis value formatter. |