From 96da92e9056c9c02e77867998424d623261daab0 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期四, 25 七月 2024 15:09:32 +0800 Subject: [PATCH] 1. 添加地图罗盘的显隐 2. 修复数据表格中O3数据列实际显示NO2的值的问题 3. 优化风向的中文描述 --- src/components/chart/ProgressLineChart.vue | 37 +++++++++++++++++++++++-------------- 1 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/components/chart/ProgressLineChart.vue b/src/components/chart/ProgressLineChart.vue index 4aedf0a..9c91a25 100644 --- a/src/components/chart/ProgressLineChart.vue +++ b/src/components/chart/ProgressLineChart.vue @@ -40,7 +40,9 @@ allSeries: [], option: null, pageSize: 200, - progress: 0 + progress: 0, + // 瀵瑰簲progress杩涘害涓嬶紝鎵�灞曠ず鏁版嵁鐨勮捣濮嬬储寮� + sIndex: 0 }; }, emits: ['chartClick'], @@ -65,13 +67,6 @@ }, locateIndex(nV, oV) { if (nV == oV) return; - // 1. 瀹氫綅鐐瑰簲璇ュ睍绀哄湪瓒嬪娍鍥句腑闂达紝鍥犳瀹氫綅鐧惧垎姣斿線鍓嶅亸绉诲綋鍓峗size鐨勪竴鍗� - let i = nV - parseInt(this.pageSize / 2); - // 2. 纭繚绱㈠紩涓嶄細瓒呭嚭鑼冨洿 - i = i < 0 ? 0 : i; - // 3. 鑾峰彇绱㈠紩瀵瑰簲鐨勮繘搴︾櫨鍒嗘瘮 - this.progress = (i / (this.allXAxis.length - this.pageSize)) * 100; - for (const iterator of this.allSeries) { // if (iterator.name == factorName || (iterator.name == 'TVOC' || factorName == 'VOC')) { iterator.markLine = { @@ -90,7 +85,21 @@ ] }; } - this.changeChartRange(); + // 璁$畻瓒呭嚭鍗曢〉鏁版嵁閲忕殑闀垮害 + let len = this.allXAxis.length - this.pageSize; + len = len < 0 ? 0 : len; + // 瀹氫綅鐐瑰簲璇ュ睍绀哄湪瓒嬪娍鍥句腑闂达紝鍥犳瀹氫綅鐧惧垎姣斿線鍓嶅亸绉诲綋鍓峗size鐨勪竴鍗� + let i = nV - parseInt(this.pageSize / 2); + // 纭繚绱㈠紩涓嶄細瓒呭嚭鑼冨洿 + i = i < 0 ? 0 : i; + i = i > len ? len : i; + // 鑾峰彇绱㈠紩瀵瑰簲鐨勮繘搴︾櫨鍒嗘瘮 + const _progress = len == 0 ? 0 : (i / len) * 100; + if (this.progress != _progress) { + this.progress = _progress; + } else { + this.changeChartRange(); + } } }, methods: { @@ -141,9 +150,7 @@ }, getShowSeries(sIndex, eIndex) { this.allSeries.forEach((s) => { - if (sIndex && eIndex) { - s.data = s.allData.slice(sIndex, eIndex); - } + s.data = s.allData.slice(sIndex, eIndex); }); const res = this.allSeries.filter((s) => { return this.selectFactorType.includes(s.key); @@ -155,8 +162,9 @@ len = len < 0 ? 0 : len; const sIndex = Math.round((len * this.progress) / 100); const eIndex = sIndex + this.pageSize; - const startPer = (sIndex / this.allXAxis.length) * 100; + const startPer = (this.sIndex / this.allXAxis.length) * 100; const endPer = (eIndex / this.allXAxis.length) * 100; + this.sIndex = sIndex; return { sIndex, eIndex, startPer, endPer }; } }, @@ -166,7 +174,8 @@ mounted() { this.lineChart = echarts.init(this.$refs.lineChart); this.lineChart.on('click', (e) => { - this.$emit('chartClick', e.dataIndex); + console.log(e); + this.$emit('chartClick', this.sIndex + e.dataIndex); }); } }; -- Gitblit v1.9.3