import { Bar, BarChart, CartesianGrid, Legend, Line, LineChart, ResponsiveContainer, Tooltip, XAxis, YAxis, } from 'recharts'; import { SurfaceCard } from '../../../components/ui/surface'; import type { DailyMileageReport } from '../api'; import { fmtDate, fmtKm } from './utils'; interface ReportChartsProps { report: DailyMileageReport; trendTargetId: number | null; onTrendTargetChange: (targetId: number | null) => void; } export default function ReportCharts({ report, trendTargetId, onTrendTargetChange, }: ReportChartsProps) { const comparisonData = report.groups.map(group => ({ name: group.displayName, 运营里程: group.operatingMileage, 库存里程: group.inventoryMileage, })); const trendGroup = trendTargetId == null ? null : report.groups.find(group => group.targetId === trendTargetId) || null; const trendData = trendGroup?.trend || report.trend; const trendName = trendGroup?.displayName || '总计'; const trendSubtitle = '选择总计或车型查看近 7 日每日里程,包含库存车辆里程'; const trendColor = trendGroup ? '#0f766e' : '#2563eb'; return (