From 41da00192b0e333cdeb654ae8e4d0c02b72f1b0c Mon Sep 17 00:00:00 2001 From: hanyuxia Date: Wed, 12 Feb 2020 12:28:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9BUG=201.dashboard?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E5=9B=BE=E8=A1=A8=E5=9B=BE=E4=BE=8B=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E6=BB=9A=E5=8A=A8=E6=9D=A1=EF=BC=9A=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E9=AB=98=E5=BA=A6=E6=AF=94=E8=AE=BE=E7=BD=AE=E7=9A=84?= =?UTF-8?q?=E9=AB=98=E5=BA=A6=E5=A4=A7=EF=BC=88=E5=9B=A0=E4=B8=BA=E5=9B=BE?= =?UTF-8?q?=E4=BE=8B=E4=B8=BA=E8=87=AA=E5=AE=9A=E4=B9=89=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=8C=85=E6=8B=AC=E5=9C=A8echarts=E9=87=8C=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/charts/line-chart-block.scss | 4 ++-- .../src/components/charts/line-chart-block.vue | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/nezha-fronted/src/components/charts/line-chart-block.scss b/nezha-fronted/src/components/charts/line-chart-block.scss index 5f7d6b116..734ab71d8 100644 --- a/nezha-fronted/src/components/charts/line-chart-block.scss +++ b/nezha-fronted/src/components/charts/line-chart-block.scss @@ -49,7 +49,7 @@ .line-area { box-sizing: border-box; background: #FFF; - min-height: 400px; + min-height: 300px; span.highcharts-title { display: block !important; width: 50%; @@ -134,7 +134,7 @@ .line-area { box-sizing: border-box; background: #FFF; - min-height: 400px; + min-height: 300px; span.highcharts-title {/*针对highcharts设置的样式,echarts需要修改??*/ display: block !important; width: 50%; diff --git a/nezha-fronted/src/components/charts/line-chart-block.vue b/nezha-fronted/src/components/charts/line-chart-block.vue index 94fc02c1a..6c17080fe 100644 --- a/nezha-fronted/src/components/charts/line-chart-block.vue +++ b/nezha-fronted/src/components/charts/line-chart-block.vue @@ -29,7 +29,7 @@
-
+
{{item.name}}
@@ -61,7 +61,7 @@
-
+
{{item.name}}
@@ -543,7 +543,6 @@ export default { option.title = title; this.echartStore.setOption(option);//创建图表 this.echartStore.hideLoading(); - this.echartStore.resize({height:chartInfo.height});//,width:`${ele.clientWidth-100}`} if(legend && legend.length>0){ this.legendList = []; legend.forEach((item, i) => { @@ -555,6 +554,12 @@ export default { this.isGrey.push(false); }); } + this.$nextTick(() => { + let divHeight = this.$refs.legendArea.offsetHeight; + let chartHeight = (chartInfo.height-divHeight); + //alert(chartInfo.title+"--"+chartHeight); + this.echartStore.resize({height:chartHeight});//,width:`${ele.clientWidth-100}`} + }); } else if (chartSite === 'screen') { // 全屏显示 /* option.series = dataArg.map((item) => {// params.series = dataArg.map((item) => { @@ -606,7 +611,6 @@ export default { option.title = {}; this.echartModalStore.setOption(option);//显示全屏界面 this.echartModalStore.hideLoading(); - this.echartModalStore.resize({height:chartInfo.height});//,width:`${ele.clientWidth-100}`} if(legend && legend.length>0){ this.screenLegendList = []; legend.forEach((item, i) => { @@ -618,6 +622,11 @@ export default { this.isGreyScreen.push(false); }); } + this.$nextTick(() => { + let divHeight = this.$refs.screenLegendArea.offsetHeight; + let chartHeight = (chartInfo.height-divHeight); + this.echartModalStore.resize({height:chartHeight}); + }); } }, handleLineFeed(str,chartWidth){