DEB 预测线填充首尾空值,确保全天 00:00-23:00 铺满
This commit is contained in:
@@ -411,6 +411,17 @@ export function getTemperatureChartData(
|
|||||||
? Number((temp + offset).toFixed(1))
|
? Number((temp + offset).toFixed(1))
|
||||||
: null,
|
: null,
|
||||||
);
|
);
|
||||||
|
const firstValid = debTemps.findIndex((t) => t != null);
|
||||||
|
const lastValid = (() => {
|
||||||
|
for (let i = debTemps.length - 1; i >= 0; i--) {
|
||||||
|
if (debTemps[i] != null) return i;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
})();
|
||||||
|
if (firstValid >= 0 && lastValid >= 0) {
|
||||||
|
for (let i = 0; i < firstValid; i++) debTemps[i] = debTemps[firstValid];
|
||||||
|
for (let i = lastValid + 1; i < debTemps.length; i++) debTemps[i] = debTemps[lastValid];
|
||||||
|
}
|
||||||
const debPast = debTemps.map((temp, index) =>
|
const debPast = debTemps.map((temp, index) =>
|
||||||
currentIndex >= 0 && index <= currentIndex ? temp : null,
|
currentIndex >= 0 && index <= currentIndex ? temp : null,
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user