"use client"; import { Area, AreaChart, Bar, BarChart, CartesianGrid, XAxis, YAxis, } from "recharts"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { type ChartConfig, ChartContainer, ChartTooltip, ChartTooltipContent, } from "@/components/ui/chart"; import { cn } from "@/lib/utils"; interface ChartGroup2Props { className?: string; } const monthLabel = (monthIndex: number) => new Intl.DateTimeFormat("fa-IR", { month: "short" }).format( new Date(2025, monthIndex, 1), ); const currencyFormatter = new Intl.NumberFormat("fa-IR", { style: "currency", currency: "IRR", minimumFractionDigits: 0, maximumFractionDigits: 0, }); const compactCurrencyFormatter = new Intl.NumberFormat("fa-IR", { style: "currency", currency: "IRR", notation: "compact", minimumFractionDigits: 0, maximumFractionDigits: 1, }); const numberFormatter = new Intl.NumberFormat("fa-IR", { maximumFractionDigits: 0, }); const compactNumberFormatter = new Intl.NumberFormat("fa-IR", { notation: "compact", maximumFractionDigits: 1, }); const mainChartData = [ { month: monthLabel(0), revenue: 18600, orders: 186 }, { month: monthLabel(1), revenue: 30500, orders: 305 }, { month: monthLabel(2), revenue: 23700, orders: 237 }, { month: monthLabel(3), revenue: 27300, orders: 273 }, { month: monthLabel(4), revenue: 20900, orders: 209 }, { month: monthLabel(5), revenue: 31400, orders: 314 }, ]; const categoryData = [ { name: "الکترونیک", value: 12400 }, { name: "پوشاک", value: 8900 }, { name: "خانه", value: 6200 }, { name: "ورزش", value: 3900 }, ]; const sourceData = [ { name: "ارگانیک", value: 4520 }, { name: "پولی", value: 3210 }, { name: "شبکه‌های اجتماعی", value: 2100 }, { name: "ارجاع", value: 1570 }, ]; const mainConfig = { revenue: { label: "درآمد", color: "var(--chart-1)" }, } satisfies ChartConfig; const categoryConfig = { value: { label: "فروش", color: "var(--chart-2)" }, } satisfies ChartConfig; const sourceConfig = { value: { label: "بازدیدکنندگان", color: "var(--chart-3)" }, } satisfies ChartConfig; const ChartGroup2 = ({ className }: ChartGroup2Props) => { return (
مرور درآمد عملکرد درآمد ماهانه compactCurrencyFormatter.format(Number(v)) } /> currencyFormatter.format(Number(value)) } /> } cursor={{ stroke: "var(--border)", strokeDasharray: "4 4" }} /> فروش به تفکیک دسته پرفروش‌ترین دسته‌های محصول compactCurrencyFormatter.format(Number(v)) } /> currencyFormatter.format(Number(value)) } /> } cursor={{ fillOpacity: 0.05 }} /> منابع ترافیک کانال‌های جذب بازدیدکننده compactNumberFormatter.format(Number(v)) } /> numberFormatter.format(Number(value)) } /> } cursor={{ fillOpacity: 0.05 }} />
); }; export { ChartGroup2 };