feat: add LiveTemperatureThresholdChart component to dashboard scan-terminal

This commit is contained in:
2569718930@qq.com
2026-05-26 07:32:02 +08:00
parent 04dcbcd6ea
commit 00e3007949
@@ -551,7 +551,7 @@ function buildRunwayHistorySeries(
: []; : [];
const values = valuesForLine const values = valuesForLine
.map((value, pointIndex) => { .map((value, pointIndex) => {
const minutesFromEnd = (valuesForLine.length - 1 - pointIndex) * FULL_DAY_SLOT_MINUTES; const minutesFromEnd = (valuesForLine.length - 1 - pointIndex);
return { return {
ts: anchor - minutesFromEnd * 60 * 1000, ts: anchor - minutesFromEnd * 60 * 1000,
value, value,
@@ -821,12 +821,17 @@ function buildFullDayChartData(
}); });
// ── Settlement observations ── // ── Settlement observations ──
// Determine if this is an HKO-sourced city to force the label
const settlementCityKey = normalizeCityKey(row?.city);
const isHKOCity = settlementCityKey === 'hongkong' || settlementCityKey === 'laufaushan'
|| settlementCityKey === 'shenzhen' || (row?.city || '').toLowerCase().includes('hong kong')
|| (row?.city || '').toLowerCase().includes('lau fau shan');
if (settlementObs.length) { if (settlementObs.length) {
const svals = binObservationsToSlots(slots, settlementObs); const svals = binObservationsToSlots(slots, settlementObs);
if (svals.some((v) => v !== null)) { if (svals.some((v) => v !== null)) {
series.push({ series.push({
key: "settlement", key: "settlement",
label: row?.metar_context?.station_label || row?.metar_context?.station || "Settlement", label: isHKOCity ? "HKO" : (row?.metar_context?.station_label || row?.metar_context?.station || "Settlement"),
source: row?.metar_context?.station || row?.airport || "Settlement", source: row?.metar_context?.station || row?.airport || "Settlement",
color: "#009688", color: "#009688",
featured: true, featured: true,
@@ -835,8 +840,13 @@ function buildFullDayChartData(
} }
} }
// ── METAR ── // ── Airport Primary (MADIS / AMSC AWOS) ──
if (madisObs.length) { // Skip this series for AMSC AWOS cities — their data is redundant with
// runway sensor data and adds a confusing "AMSC AWOS" label to the chart.
const isAmscSource =
(hourly?.airportPrimary as any)?.source === "amsc_awos" ||
String(hourly?.airportPrimary?.source_label || "").toLowerCase().includes("amsc");
if (madisObs.length && !isAmscSource) {
const madisVals = binObservationsToSlots(slots, madisObs); const madisVals = binObservationsToSlots(slots, madisObs);
if (madisVals.some((v) => v !== null)) { if (madisVals.some((v) => v !== null)) {
series.push({ series.push({
@@ -855,7 +865,7 @@ function buildFullDayChartData(
if (mvals.some((v) => v !== null)) { if (mvals.some((v) => v !== null)) {
series.push({ series.push({
key: "metar", key: "metar",
label: row?.metar_context?.station_label || "METAR", label: isHKOCity ? "HKO" : (row?.metar_context?.station_label || "METAR"),
source: row?.airport || "METAR", source: row?.airport || "METAR",
color: "#0ea5e9", color: "#0ea5e9",
dashed: true, dashed: true,
@@ -1117,11 +1127,12 @@ export function LiveTemperatureThresholdChart({
const cityKey = String(row?.city || "").toLowerCase().trim(); const cityKey = String(row?.city || "").toLowerCase().trim();
const runwaySensorCities = new Set([ const runwaySensorCities = new Set([
'beijing', 'shanghai', 'guangzhou', 'shenzhen', 'qingdao', 'beijing', 'shanghai', 'guangzhou', 'qingdao',
'chengdu', 'chongqing', 'wuhan', // AMSC runway sensors 'chengdu', 'chongqing', 'wuhan', // AMSC runway sensors
'seoul', 'busan', // AMOS runway sensors 'seoul', 'busan', // AMOS runway sensors
]); ]);
const isHKO = cityKey === 'hong kong' || cityKey === 'lau fau shan' || cityKey.includes('hongkong') || cityKey.includes('laufau'); const isHKO = cityKey === 'hong kong' || cityKey === 'lau fau shan' || cityKey === 'shenzhen'
|| cityKey.includes('hongkong') || cityKey.includes('laufau');
const isTokyo = cityKey === 'tokyo'; const isTokyo = cityKey === 'tokyo';
const isSingapore = cityKey === 'singapore'; const isSingapore = cityKey === 'singapore';
const isParis = cityKey === 'paris'; const isParis = cityKey === 'paris';