{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "area-chart", "type": "registry:component", "title": "Area Chart", "description": "Beautiful area chart for data visualization with retro styling", "dependencies": [ "recharts" ], "files": [ { "path": "components/retroui/charts/AreaChart.tsx", "content": "\"use client\"\n\nimport { cn } from \"@/lib/utils\"\nimport React from \"react\"\nimport {\n Area,\n AreaChart as RechartsAreaChart,\n CartesianGrid,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from \"recharts\"\n\ninterface AreaChartProps extends React.HTMLAttributes {\n data: Record[]\n index: string\n categories: string[]\n strokeColors?: string[]\n fillColors?: string[]\n tooltipBgColor?: string\n tooltipBorderColor?: string\n gridColor?: string\n valueFormatter?: (value: number) => string\n showGrid?: boolean\n showTooltip?: boolean\n fill?: \"gradient\" | \"solid\"\n className?: string\n}\n\nconst AreaChart = React.forwardRef(\n (\n {\n data = [],\n index,\n categories = [],\n strokeColors = [\"var(--foreground)\"],\n fillColors = [\"var(--primary)\"],\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 fill = \"gradient\",\n className,\n ...props\n },\n ref\n ) => {\n const chartId = React.useId()\n\n return (\n
\n \n \n \n {categories.map((category, index) => {\n const fillColor = fillColors[index] || fillColors[0]\n const gradientId = `gradient-${chartId}-${category}`\n return (\n \n {fill === \"gradient\" ? (\n <>\n \n \n \n ) : (\n \n )}\n \n )\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 const gradientId = `gradient-${chartId}-${category}`\n \n return (\n \n )\n })}\n
\n
\n
\n )\n }\n)\n\nAreaChart.displayName = \"AreaChart\"\n\nexport { AreaChart, type AreaChartProps }", "type": "registry:component", "target": "components/retroui/charts/AreaChart.tsx" } ] }