"use client"; import { BarChart, Bar, XAxis, YAxis, Tooltip, ResponsiveContainer, CartesianGrid, } from "recharts"; interface VesselData { name: string; amount: number; } interface MonthData { month: string; amount: number; } interface Props { vesselData: VesselData[]; monthData: MonthData[]; } function currencyTick(value: number): string { if (value >= 1_000_000) return `₹${(value / 1_000_000).toFixed(1)}M`; if (value >= 1_000) return `₹${(value / 1_000).toFixed(0)}K`; return `₹${value}`; } function currencyTooltip(value: number): string { return value.toLocaleString("en-IN", { style: "currency", currency: "INR", maximumFractionDigits: 0 }); } export function SpendCharts({ vesselData, monthData }: Props) { return (
{vesselData.length > 0 && (

Approved Spend by Cost Centre (Top 5)

[currencyTooltip(Number(v)), "Spend"]} cursor={{ fill: "#f5f5f5" }} />
)} {monthData.length > 0 && (

Approved Spend by Month

[currencyTooltip(Number(v)), "Spend"]} cursor={{ fill: "#f5f5f5" }} />
)}
); }