From aba444f58264a5b6a016ddc3e6076de8e9379950 Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期二, 05 十二月 2023 16:29:13 +0800 Subject: [PATCH] 设备超出点点点 --- src/views/cockpitPage/components/DeviceChart.vue | 27 +++++++++++++++++++-------- 1 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/views/cockpitPage/components/DeviceChart.vue b/src/views/cockpitPage/components/DeviceChart.vue index faf08b0..769ce8b 100644 --- a/src/views/cockpitPage/components/DeviceChart.vue +++ b/src/views/cockpitPage/components/DeviceChart.vue @@ -46,11 +46,12 @@ // }, startValue: 0, endValue: 5, + chartTimer:null, }; }, watch: { "chartData.datay"(val) { - console.log(val, "ddddddddddddddd"); + console.log(val, "璁惧鍙樻洿鏁版嵁"); this.ydata = val; this.startValue = 0; this.endValue = 5; @@ -64,14 +65,18 @@ //鍦ㄨ亴 pieChart(chartName, data) { let that = this; + clearInterval(this.chartTimer); + let chartDomTwo = this.$refs[chartName]; + let myChartTwo = echarts.init(chartDomTwo) + myChartTwo.dispose() let chartDom = this.$refs[chartName]; - if (myChart != null && myChart != "" && myChart != undefined) { - console.log("222222222"); - myChart.dispose(); //閿�姣� - myChart.resize(); - } - console.log(myChart, "ssssssss"); myChart = echarts.init(chartDom); + // if (myChart != null && myChart != "" && myChart != undefined) { + // console.log("222222222"); + // myChart.dispose(); //閿�姣� + // myChart.resize(); + // } + // console.log(myChart, "ssssssss"); let option; let lineColor = "#35ddc74d"; if (this.ydata) { @@ -131,6 +136,12 @@ } }, }, + formatter:function(value){ + if(value.length>6){ + return `${value.slice(0,4)}...` + } + return value; + } }, data: data.datax ? data.datax : [], }, @@ -202,7 +213,7 @@ ], }; - setInterval(function () { + this.chartTimer=setInterval(function () { if (option.dataZoom[0].endValue == data.datay.length) { option.dataZoom[0].startValue = that.startValue; option.dataZoom[0].endValue = that.endValue; -- Gitblit v1.8.0