From 3b288dc4c45458b4ede7954ae97b74990b28c5e9 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Mon, 25 May 2026 05:34:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B0=94=E6=B8=A9=E8=B5=B0=E5=8A=BF=E5=9B=BE?= =?UTF-8?q?=20Y=20=E8=BD=B4=E6=94=B9=E7=94=A8=E5=B8=82=E5=9C=BA=E5=90=88?= =?UTF-8?q?=E7=BA=A6=E6=B8=A9=E5=BA=A6=E9=80=89=E9=A1=B9=E5=88=BB=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 纵坐标从 distribution_full 提取温度分桶作为 ticks,domain 动态计算而非硬编码。 --- .../LiveTemperatureThresholdChart.tsx | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/frontend/components/dashboard/scan-terminal/LiveTemperatureThresholdChart.tsx b/frontend/components/dashboard/scan-terminal/LiveTemperatureThresholdChart.tsx index 962c694b..16450419 100644 --- a/frontend/components/dashboard/scan-terminal/LiveTemperatureThresholdChart.tsx +++ b/frontend/components/dashboard/scan-terminal/LiveTemperatureThresholdChart.tsx @@ -279,6 +279,22 @@ export function LiveTemperatureThresholdChart({ const { data, series } = useMemo(() => buildEvidenceChart(row, hourly), [row, hourly]); const threshold = validNumber(row?.target_threshold) ?? validNumber(row?.target_value); const tableRows = series.slice(0, 5).map((item) => ({ ...item, ...seriesStats(item.values) })); + const marketTemperatures = useMemo(() => { + const buckets = row?.distribution_full?.length + ? row.distribution_full + : row?.distribution_preview; + if (!buckets?.length) return null; + const temps = buckets + .map((b) => validNumber(b.value)) + .filter((v): v is number => v !== null) + .sort((a, b) => a - b); + if (!temps.length) return null; + const padding = temps.length > 1 ? temps[1] - temps[0] : 2; + return { + ticks: temps, + domain: [temps[0] - padding, temps[temps.length - 1] + padding] as [number, number], + }; + }, [row]); return ( @@ -327,7 +343,14 @@ export function LiveTemperatureThresholdChart({ - `${Number(v).toFixed(1)}°`} axisLine={{ stroke: "#cbd5e1" }} tickLine={false} /> + `${Number(v).toFixed(1)}°`} + axisLine={{ stroke: "#cbd5e1" }} + tickLine={false} + domain={marketTemperatures?.domain ?? ["auto", "auto"]} + ticks={marketTemperatures?.ticks} + /> {threshold !== null && (