From c24a5a2a99515b365ebc343b04538bb862790de1 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期四, 21 十二月 2023 11:44:22 +0800 Subject: [PATCH] Merge branch 'feature-code-refactoring' and 'feature-002' --- src/utils/chartFunction/lineChart.js | 68 ++++++---------------------------- 1 files changed, 12 insertions(+), 56 deletions(-) diff --git a/src/utils/chartFunction/lineChart.js b/src/utils/chartFunction/lineChart.js index d9bd8e2..1c4bc2e 100644 --- a/src/utils/chartFunction/lineChart.js +++ b/src/utils/chartFunction/lineChart.js @@ -47,10 +47,6 @@ xData.push(tempData.lst) yAvg.push(tempData.dayAvg) - // yOnline.push(this.deleteLastStr(tempData.dayOnline)) - // yValid.push(this.deleteLastStr(tempData.dayValid)) - // yExceed.push(this.deleteLastStr(tempData.dayExceeding)) - yOnline.push(tempData.dayOnline) yValid.push(tempData.dayValid) yExceed.push(tempData.dayExceeding) @@ -83,47 +79,11 @@ }, /** - * 杩斿洖鏃犳暟鎹殑鏃堕棿娈� - * @param锛� - * @returns锛� - */ - backNoDataInteval(dataBeginTime, dataEndTime) { - const result = [] - // 鏁版嵁寮�濮嬫椂闂� - const start = dayjs(dataBeginTime) - // 鏁版嵁缁撴潫鏃堕棿 - const end = dayjs(dataEndTime) - // 璇ユ湀鐨�1鍙� - const monthStart = start.startOf('month') - // 璇ユ湀鏈�鍚庝竴澶� - const monthEnd = start.endOf('month') - - // 鏁版嵁璧峰涓嶇瓑浜庢湀鍒� 涓� 鏁版嵁缁撴潫涓嶇瓑浜庢湀鏈� - if (!start.isSame(monthStart, 'day') && !end.isSame(monthEnd, 'day')) { - result.push([monthStart.format('YYYY-MM-DD'), start.format('YYYY-MM-DD')]) - result.push([end.format('YYYY-MM-DD'), monthEnd.format('YYYY-MM-DD')]) - } - - // 鏁版嵁璧峰绛変簬鏈堝垵 涓� 鏁版嵁缁撴潫涓嶇瓑浜庢湀鏈� - if (start.isSame(monthStart, 'day') && !end.isSame(monthEnd, 'day')) { - result.push([end.format('YYYY-MM-DD'), monthEnd.format('YYYY-MM-DD')]) - } - - // 鏁版嵁璧峰涓嶇瓑浜庢湀鍒� 涓� 鏁版嵁缁撴潫绛変簬鏈堟湯 - if (!start.isSame(monthStart, 'day') && end.isSame(monthEnd, 'day')) { - result.push([monthStart.format('YYYY-MM-DD'), start.format('YYYY-MM-DD')]) - } - - // 鏁版嵁璧峰绛変簬鏈堝垵 涓� 鏁版嵁缁撴潫绛変簬鏈堟湯 (杩欑鎯呭喌娌℃湁绌烘暟鎹殑鏃堕棿闂撮殧) - return result - }, - - /** * 缁勬垚鏃犳暟鎹尯鍩� * @param锛� 2缁存暟缁� * @returns锛� */ - getMarkArea(timeInteval,describe='鏃犳暟鎹�') { + getMarkArea(timeInteval, describe = '鏃犳暟鎹�') { let result = [] for (let i = 0; i < timeInteval.length; i++) { let temp = [] @@ -170,48 +130,44 @@ return valueStr.slice(0, -1) }, - /** * 鎸囧畾鏃堕棿鍖洪棿鐨勭嚎娈靛彉棰滆壊 - * @param锛� + * @param锛� * @returns锛� */ - getLineColor(timeInteval,xList){ + getLineColor(timeInteval, xList) { let result = [] // 鍙彇 let temp = [] - for (let i = 0; i < timeInteval.length; i++){ - if(timeInteval[i][0]!=timeInteval[i][1]){ + for (let i = 0; i < timeInteval.length; i++) { + if (timeInteval[i][0] != timeInteval[i][1]) { temp.push(timeInteval[i]) } - } + } // 鏃犺繛缁殑鏁版嵁 鐩存帴閫�鍑� - if(temp.length == 0){ + if (temp.length == 0) { return [] } // 鍙栫涓�涓繛缁殑鏃舵 - result.push( - [ + result.push([ { lte: temp[0][0], color: 'green' }, { gt: temp[0][0], - lte:temp[0][1], + lte: temp[0][1], color: 'red' }, { gt: temp[0][1], - lte:xList[xList.length-1], + lte: xList[xList.length - 1], color: 'green' } - ] - ) + ]) return result[0] - }, - + } } -- Gitblit v1.9.3