"use client"; import { Bar, BarChart, CartesianGrid, Cell, ComposedChart, LabelList, ResponsiveContainer, Tooltip, XAxis, YAxis, } from "recharts"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { CHART_TOOLTIP_STYLE } from "@/lib/chart-utils"; type DebChartRow = { name: string; cityId: string; hitRate: number; mae: number; days: number; }; type MuChartRow = { name: string; cityId: string; brierScore: number; hitRate: number; mae: number; days: number; }; const CHART_COLORS = { green: "#22c55e", yellow: "#eab308", red: "#ef4444", }; function hitColor(hitRate: number) { if (hitRate >= 80) return CHART_COLORS.green; if (hitRate >= 60) return CHART_COLORS.yellow; return CHART_COLORS.red; } function maeColor(mae: number) { if (mae <= 1.5) return CHART_COLORS.green; if (mae <= 2.5) return CHART_COLORS.yellow; return CHART_COLORS.red; } function brierColor(score: number) { if (score <= 0.1) return CHART_COLORS.green; if (score <= 0.25) return CHART_COLORS.yellow; return CHART_COLORS.red; } export function TrainingAccuracyCharts({ debChartData, muChartData, }: { debChartData: DebChartRow[]; muChartData: MuChartRow[]; }) { return ( <> {debChartData.length > 0 ? (
DEB 命中率 by 城市
[`${Number(value).toFixed(1)}%`, "命中率"]} /> {debChartData.map((entry, i) => ( ))} `${Number(v)}%`} />
DEB MAE by 城市
[`${Number(value).toFixed(1)}°`, "MAE"]} /> {debChartData.map((entry, i) => ( ))} `${Number(v)}°`} />
) : null} {muChartData.length > 0 ? (
概率 μ Brier Score by 城市
[Number(value).toFixed(4), "Brier Score"]} /> {muChartData.map((entry, i) => ( ))} Number(v).toFixed(3)} />
概率 μ 命中率 by 城市
[`${Number(value).toFixed(1)}%`, "命中率"]} /> {muChartData.map((entry, i) => ( ))} `${Number(v)}%`} />
) : null} ); }