回退 debTemps 首尾填充,修复 canvas CSS 无尺寸导致的图表缩塌
- 首尾填充会画成水平直线不反映预测,回退;past_days=1 已从后端补齐全天数据 - canvas 保留 width/height:100% 但去掉 !important,Chart.js 自管分辨率
This commit is contained in:
@@ -107,6 +107,8 @@
|
|||||||
|
|
||||||
.root :global(.detail-mini-chart canvas) {
|
.root :global(.detail-mini-chart canvas) {
|
||||||
display: block;
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.root :global(.detail-mini-chart-legend) {
|
.root :global(.detail-mini-chart-legend) {
|
||||||
|
|||||||
@@ -786,6 +786,8 @@
|
|||||||
|
|
||||||
.root :global(.intraday-scene-frame canvas) {
|
.root :global(.intraday-scene-frame canvas) {
|
||||||
display: block;
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.root :global(.intraday-scene-legend) {
|
.root :global(.intraday-scene-legend) {
|
||||||
|
|||||||
@@ -1061,6 +1061,8 @@
|
|||||||
|
|
||||||
.root :global(.scan-ai-city-chart canvas) {
|
.root :global(.scan-ai-city-chart canvas) {
|
||||||
display: block;
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.root :global(.scan-ai-city-chart-placeholder) {
|
.root :global(.scan-ai-city-chart-placeholder) {
|
||||||
|
|||||||
@@ -411,17 +411,6 @@ 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