"use client"; import { Area, AreaChart, Bar, BarChart, CartesianGrid, Line, LineChart, 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 { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { cn } from "@/lib/utils"; interface ChartGroup4Props { 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 chartData = [ { month: monthLabel(0), revenue: 18600, orders: 186, customers: 145 }, { month: monthLabel(1), revenue: 30500, orders: 305, customers: 220 }, { month: monthLabel(2), revenue: 23700, orders: 237, customers: 180 }, { month: monthLabel(3), revenue: 27300, orders: 273, customers: 195 }, { month: monthLabel(4), revenue: 20900, orders: 209, customers: 165 }, { month: monthLabel(5), revenue: 31400, orders: 314, customers: 240 }, ]; const metricTabs = [ { value: "revenue", label: "درآمد" }, { value: "orders", label: "سفارش‌ها" }, { value: "customers", label: "مشتریان" }, ] as const; const revenueConfig = { revenue: { label: "درآمد", color: "var(--chart-1)" }, } satisfies ChartConfig; const ordersConfig = { orders: { label: "سفارش‌ها", color: "var(--chart-2)" }, } satisfies ChartConfig; const customersConfig = { customers: { label: "مشتریان", color: "var(--chart-3)" }, } satisfies ChartConfig; const ChartGroup4 = ({ className }: ChartGroup4Props) => { return (
شاخص‌های عملکرد مشاهده شاخص‌های مختلف در طول زمان {metricTabs.map((tab) => ( {tab.label} ))} 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 }} /> compactNumberFormatter.format(Number(v)) } /> numberFormatter.format(Number(value)) } /> } cursor={{ stroke: "var(--border)", strokeDasharray: "4 4" }} />
); }; export { ChartGroup4 };