"use client"; import { ResponsiveContainer, Treemap } from "recharts"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { cn } from "@/lib/utils"; interface ChartCard22Props { title?: string; description?: string; className?: string; } const chartData = [ { name: "الکترونیک", children: [ { name: "گوشی", size: 4500, color: "var(--chart-1)" }, { name: "لپ‌تاپ", size: 3200, color: "var(--chart-1)" }, { name: "تبلت", size: 1800, color: "var(--chart-1)" }, ], }, { name: "پوشاک", children: [ { name: "پیراهن", size: 2800, color: "var(--chart-2)" }, { name: "شلوار", size: 2100, color: "var(--chart-2)" }, { name: "کفش", size: 1600, color: "var(--chart-2)" }, ], }, { name: "خانه", children: [ { name: "مبلمان", size: 2400, color: "var(--chart-3)" }, { name: "دکور", size: 1200, color: "var(--chart-3)" }, ], }, { name: "ورزش", children: [ { name: "تجهیزات", size: 1800, color: "var(--chart-4)" }, { name: "پوشاک ورزشی", size: 900, color: "var(--chart-4)" }, ], }, ]; interface TreemapContentProps { x: number; y: number; width: number; height: number; name: string; color?: string; depth: number; } const CustomContent = ({ x, y, width, height, name, color, depth, }: TreemapContentProps) => { if (depth !== 2) return null; const showLabel = width > 50 && height > 30; return ( {showLabel && ( {name} )} ); }; const ChartCard22 = ({ title = "فروش به تفکیک دسته", description = "توزیع درآمد میان دسته‌های محصول", className, }: ChartCard22Props) => { return ( {title} {description}
} />
{chartData.map((category, index) => (
{category.name}
))}
); }; export { ChartCard22 };