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){