| | |
| | | // 预计算颜色阶段时间点 |
| | | function precomputeColorStages() { |
| | | if (!rainTotalInfo.value || rainTotalInfo.value.length === 0) return; |
| | | |
| | | // 颜色配置(亮度递减) |
| | | const COLOR_STOPS = [ |
| | | { hex: "#F5F0E6", luminance: 240.4 }, // stage 0 |
| | |
| | | -0.7, // stage 5 |
| | | -0.8 // stage 6 |
| | | ]; |
| | | |
| | | // 累计降雨量阈值(mm) |
| | | const R_THRESHOLDS = [0, 200, 240, 280, 310, 350]; // 共6个阶段对应6个阈值 |
| | | |
| | | // 时间和降雨量信息 |
| | | const timeTotals = []; |
| | | const initialTimestamp = new Date(rainTotalInfo.value[0].time).getTime(); |
| | |
| | | |
| | | // 找出每个阶段首次达到的时间点 |
| | | const stages = []; |
| | | |
| | | for (let stage = 1; stage < R_THRESHOLDS.length + 1; stage++) { |
| | | const threshold = R_THRESHOLDS[stage - 1]; |
| | | for (let i = 0; i < timeTotals.length; i++) { |