From 88971f7c42e4bbc628da4d341743efff9b8001fa Mon Sep 17 00:00:00 2001 From: ihzero Date: Mon, 14 Nov 2022 10:13:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=A7=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/visualization/components/DXCY.vue | 52 +++++++++++++++----- src/views/visualization/components/DZWZ.vue | 53 ++++++++++++++++----- src/views/visualization/index.vue | 3 +- 3 files changed, 83 insertions(+), 25 deletions(-) diff --git a/src/views/visualization/components/DXCY.vue b/src/views/visualization/components/DXCY.vue index 319acc42..8efc00e6 100644 --- a/src/views/visualization/components/DXCY.vue +++ b/src/views/visualization/components/DXCY.vue @@ -141,33 +141,61 @@ let timer: any = null function chartAmi() { let index = 0 + const timerNumber = 3000 + let sleep = 1 timer && clearInterval(timer) timer = setInterval(() => { - const currentIndex = index % legendData.length - // getInstance()?.dispatchAction({ - // type: 'legendUnSelect', - // name: legendData[currentIndex], - // }) - - // getInstance()?.dispatchAction({ - // type: 'legendSelect', - // name: legendData[currentIndex], - // }) + const currentIndex = index % 4 + sleep = index % (4 * 2) getInstance()?.dispatchAction({ type: 'showTip', seriesIndex: 0, dataIndex: currentIndex, }) + if (sleep == 7) { + chartLineAmi() + } index++ - }, 3000) + }, timerNumber) + } + + function chartLineAmi() { + const timerNumber = 3000 + timer && clearInterval(timer) + let legendIndex = legendData.length + let sleep = 6000 / 3000 + timer = setInterval(() => { + getInstance()?.dispatchAction({ + type: 'hideTip', + }) + if (legendIndex == legendData.length) { + legendData.forEach((_, index) => { + getInstance()?.dispatchAction({ + type: 'legendUnSelect', + name: legendData[index], + }) + }) + } + if (legendIndex >= 0) { + getInstance()?.dispatchAction({ + type: 'legendSelect', + name: legendData[legendIndex - 1], + }) + } + if (legendIndex <= 0) { + if (sleep <= 0) getData() + sleep-- + } + legendIndex-- + }, timerNumber) } onBeforeMount(() => { getData() rootEmitter.on('interval:auto', () => { - getData() + // getData() }) }) diff --git a/src/views/visualization/components/DZWZ.vue b/src/views/visualization/components/DZWZ.vue index e5b6de2c..ffd2ea13 100644 --- a/src/views/visualization/components/DZWZ.vue +++ b/src/views/visualization/components/DZWZ.vue @@ -191,18 +191,12 @@ let timer: any = null function chartAmi() { let index = 0 + const timerNumber = 3000 + let sleep = 1 timer && clearInterval(timer) timer = setInterval(() => { - const currentIndex = index % legendData.length - // getInstance()?.dispatchAction({ - // type: 'legendUnSelect', - // name: legendData[currentIndex], - // }) - - // getInstance()?.dispatchAction({ - // type: 'legendSelect', - // name: legendData[currentIndex], - // }) + const currentIndex = index % 4 + sleep = index % (4 * 2) getInstance()?.dispatchAction({ type: 'showTip', @@ -210,8 +204,43 @@ dataIndex: currentIndex, }) + if (sleep == 7) { + chartLineAmi() + } + index++ - }, 3000) + }, timerNumber) + } + + function chartLineAmi() { + const timerNumber = 3000 + timer && clearInterval(timer) + let legendIndex = legendData.length + let sleep = 6000 / 3000 + timer = setInterval(() => { + getInstance()?.dispatchAction({ + type: 'hideTip', + }) + if (legendIndex == legendData.length) { + legendData.forEach((_, index) => { + getInstance()?.dispatchAction({ + type: 'legendUnSelect', + name: legendData[index], + }) + }) + } + if (legendIndex >= 0) { + getInstance()?.dispatchAction({ + type: 'legendSelect', + name: legendData[legendIndex - 1], + }) + } + if (legendIndex <= 0) { + if (sleep <= 0) getData() + sleep-- + } + legendIndex-- + }, timerNumber) } watch( @@ -224,7 +253,7 @@ onBeforeMount(() => { getData() rootEmitter.on('interval:auto', () => { - getData() + // getData() }) }) diff --git a/src/views/visualization/index.vue b/src/views/visualization/index.vue index a8367b26..acf8a917 100644 --- a/src/views/visualization/index.vue +++ b/src/views/visualization/index.vue @@ -1,7 +1,8 @@