import { Bar, BarChart, Cell, Legend, ResponsiveContainer, Tooltip, XAxis, YAxis, } from 'recharts'; import type { HydrogenMonthlyPoint } from '../../types'; import { formatYuan as fmtYuan } from '../model'; type MonthlyChartPoint = HydrogenMonthlyPoint & { monthLabel: string }; interface MonthlyChartsProps { activeYear: number; monthly: HydrogenMonthlyPoint[]; monthlyDual: MonthlyChartPoint[]; } export function MonthlyCharts({ activeYear, monthly, monthlyDual }: MonthlyChartsProps) { return ( <> {monthly.length > 0 && (
{activeYear} 年月度加氢量 单位 Kg
[`${Number(v ?? 0).toLocaleString('zh-CN', { maximumFractionDigits: 0 })} Kg`, '加氢量']} labelFormatter={(d) => `${d}`} contentStyle={{ borderRadius: 12, fontSize: 12 }} cursor={{ fill: 'rgba(34, 211, 238, 0.06)' }} /> {monthlyDual.map((_, i) => ( ))}
)} {monthly.length > 0 && (
{activeYear} 年月度收支对比 单位 元
{ const f = fmtYuan(Number(v ?? 0)); return [`¥${f.value} ${f.unit}`, name]; }} contentStyle={{ borderRadius: 12, fontSize: 12 }} cursor={{ fill: 'rgba(148, 163, 184, 0.06)' }} />
)} ); }