Browse Source

调整一个图形时样式

yuhan 2 months ago
parent
commit
9bb41a138b
1 changed files with 6 additions and 2 deletions
  1. 6 2
      src/views/module_tpm/equipmentRunStatis/realtime.vue

+ 6 - 2
src/views/module_tpm/equipmentRunStatis/realtime.vue

@@ -54,7 +54,7 @@ export default {
       dataSource: [],
       times: [],
       myChart: null,
-      echartsHeight: window.innerHeight - 450,
+      echartsHeight: window.innerHeight - 330,
       // 查询参数
       queryParams: {
         equipmentid: '',
@@ -249,7 +249,7 @@ export default {
       }
       _this.myChart = echarts.init(chartDom)
       // _this.echartsHeight = 4 * 300;
-      _this.echartsHeight = _this.equipmentparams.length * 180;
+      _this.echartsHeight = _this.equipmentparams.length > 1 ? _this.equipmentparams.length * 180 : window.innerHeight - 330;
       // 获取time
       _this.times = [];
       _this.mongodbdata.forEach((i) => {
@@ -268,6 +268,10 @@ export default {
       var paramscount = 0;
       var paramslength = _this.equipmentparams.length;
       _this.equipmentparams.forEach((item) => {
+        if(paramslength === 1){
+          // 只有一个时,占满屏
+          grid.push({left: leftValue, top: "5%", bottom: "8%"});
+        }
         // 加判断是为了最上和最下有点间距好看,也可以不判断直接用注释那句
         var firstTop = 3 // 最上面一个距离顶部占比2%
         var lastBottom = 2 // 最上面一个距离顶部占比2%