import { formatNumber, calculateNiceRange } from "~/lib/utils"; export interface BarChartData { label: string; value: number; maxValue?: number; color?: string; labelColor?: string; valuePrefix?: string; valueSuffix?: string; } interface CustomBarChartProps { data: BarChartData[]; title?: string; height?: string; barHeight?: string; showAxisLabels?: boolean; className?: string; loading?: boolean; hasPercent ?: boolean } export function CustomBarChart({ data, title, height = "auto", barHeight = "h-6", showAxisLabels = true, className = "", loading = false, hasPercent = true, }: CustomBarChartProps) { // استفاده از nice numbers برای محاسبه دامنه مناسب const values = data.map((item) => item.maxValue || item.value); const { niceMax, ticks } = calculateNiceRange(values, 0, 5); const globalMaxValue = niceMax; // Loading skeleton if (loading) { return (