{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "line-chart", "type": "registry:component", "title": "Line Chart", "description": "Beautiful line chart for data visualization with retro styling", "dependencies": [ "recharts" ], "files": [ { "path": "components/retroui/charts/LineChart.tsx", "content": "\"use client\"\n\nimport { cn } from \"@/lib/utils\"\nimport React from \"react\"\nimport {\n CartesianGrid,\n Line,\n LineChart as RechartsLineChart,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from \"recharts\"\n\ninterface LineChartProps extends React.HTMLAttributes {\n data: Record[]\n index: string\n categories: string[]\n strokeColors?: string[]\n tooltipBgColor?: string\n tooltipBorderColor?: string\n gridColor?: string\n valueFormatter?: (value: number) => string\n showGrid?: boolean\n showTooltip?: boolean\n strokeWidth?: number\n dotSize?: number\n className?: string\n}\n\nconst LineChart = React.forwardRef(\n (\n {\n data = [],\n index,\n categories = [],\n strokeColors = [\"var(--foreground)\"],\n tooltipBgColor = \"var(--background)\",\n tooltipBorderColor = \"var(--border)\",\n gridColor = \"var(--muted)\",\n valueFormatter = (value: number) => value.toString(),\n showGrid = true,\n showTooltip = true,\n strokeWidth = 2,\n dotSize = 4,\n className,\n ...props\n },\n ref\n ) => {\n return (\n
\n \n \n {showGrid && (\n \n )}\n \n \n \n \n \n {showTooltip && (\n {\n if (!active || !payload?.length) return null\n \n return (\n
\n
\n
\n \n {index}\n \n \n {label}\n \n
\n {payload.map((entry, index) => (\n
\n \n {entry.dataKey}\n \n \n {valueFormatter(entry.value as number)}\n \n
\n ))}\n
\n
\n )\n }}\n />\n )}\n \n {categories.map((category, index) => {\n const strokeColor = strokeColors[index] || strokeColors[0]\n \n return (\n \n )\n })}\n
\n
\n
\n )\n }\n)\n\nLineChart.displayName = \"LineChart\"\n\nexport { LineChart, type LineChartProps }", "type": "registry:component", "target": "components/retroui/charts/LineChart.tsx" } ] }