"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 ChartGroup1Props { 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 revenueData = [ { month: monthLabel(0), value: 18600 }, { month: monthLabel(1), value: 30500 }, { month: monthLabel(2), value: 23700 }, { month: monthLabel(3), value: 27300 }, { month: monthLabel(4), value: 20900 }, { month: monthLabel(5), value: 31400 }, ]; const ordersData = [ { month: monthLabel(0), value: 186 }, { month: monthLabel(1), value: 305 }, { month: monthLabel(2), value: 237 }, { month: monthLabel(3), value: 273 }, { month: monthLabel(4), value: 209 }, { month: monthLabel(5), value: 314 }, ]; const revenueConfig = { value: { label: "درآمد", color: "var(--chart-1)", }, } satisfies ChartConfig; const ordersConfig = { value: { label: "سفارش‌ها", color: "var(--chart-2)", }, } satisfies ChartConfig; const ChartGroup1 = ({ className }: ChartGroup1Props) => { return (
درآمد روند درآمد ماهانه compactCurrencyFormatter.format(Number(v)) } /> currencyFormatter.format(Number(value)) } /> } cursor={{ stroke: "var(--border)", strokeDasharray: "4 4" }} /> سفارش‌ها حجم سفارش ماهانه compactNumberFormatter.format(Number(v)) } /> numberFormatter.format(Number(value)) } /> } cursor={{ fillOpacity: 0.05 }} />
); }; export { ChartGroup1 };