| | |
| | | }, |
| | | 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 = { |
| | |
| | | ] |
| | | }; |
| | | } |
| | | 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: { |
| | |
| | | }, |
| | | 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); |
| | |
| | | mounted() { |
| | | this.lineChart = echarts.init(this.$refs.lineChart); |
| | | this.lineChart.on('click', (e) => { |
| | | console.log(e); |
| | | this.$emit('chartClick', this.sIndex + e.dataIndex); |
| | | }); |
| | | } |