"use client"; import { Area, AreaChart, 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 ChartCard14Props { title?: string; description?: string; className?: string; } const monthLabel = (monthIndex: number) => new Intl.DateTimeFormat("fa-IR", { month: "short" }).format( new Date(2025, monthIndex, 1), ); const numberFormatter = new Intl.NumberFormat("fa-IR", { maximumFractionDigits: 0, }); const formatMilliseconds = (value: number) => `${numberFormatter.format(value)} میلی‌ثانیه`; const chartData = [ { month: monthLabel(0), min: 120, max: 180, avg: 150 }, { month: monthLabel(1), min: 140, max: 220, avg: 175 }, { month: monthLabel(2), min: 130, max: 195, avg: 160 }, { month: monthLabel(3), min: 155, max: 240, avg: 190 }, { month: monthLabel(4), min: 145, max: 210, avg: 175 }, { month: monthLabel(5), min: 160, max: 250, avg: 200 }, { month: monthLabel(6), min: 170, max: 260, avg: 215 }, { month: monthLabel(7), min: 165, max: 245, avg: 205 }, ]; const chartConfig = { range: { label: "بازه", color: "var(--chart-1)", }, avg: { label: "میانگین", color: "var(--chart-2)", }, } satisfies ChartConfig; const ChartCard14 = ({ title = "بازه زمان پاسخ", description = "حداقل، حداکثر و میانگین زمان پاسخ", className, }: ChartCard14Props) => { return ( {title} {description} `${numberFormatter.format(Number(value))}ms` } /> { const formatted = formatMilliseconds(Number(value)); if (name === "min") return `حداقل: ${formatted}`; if (name === "max") return `حداکثر: ${formatted}`; if (name === "avg") return `میانگین: ${formatted}`; return formatted; }} /> } cursor={{ stroke: "var(--border)", strokeDasharray: "4 4" }} /> ); }; export { ChartCard14 };