Browse Source

修改图间距

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

+ 15 - 15
src/views/module_tpm/equipmentRunStatis/realtime.vue

@@ -268,25 +268,25 @@ export default {
       var paramscount = 0;
       var paramslength = _this.equipmentparams.length;
       _this.equipmentparams.forEach((item) => {
-        if(paramslength === 1){
-          // 只有一个时,占满屏
-          grid.push({left: leftValue, top: "15%", bottom: "8%"});
-        }
-        if(paramslength === 2){
-          // 当两个时
-          grid.push({left: leftValue,top: '15%', bottom: "56%"}, {left: leftValue, top: "58%", bottom: '8%'});
-        }
+        // if(paramslength === 1){
+        //   // 只有一个时,占满屏
+        //   grid.push({left: leftValue, top: "15%", bottom: "8%"});
+        // }
+        // if(paramslength === 2){
+        //   // 当两个时
+        //   grid.push({left: leftValue,top: '15%', bottom: "56%"}, {left: leftValue, top: "58%", bottom: '8%'});
+        // }
         // 加判断是为了最上和最下有点间距好看,也可以不判断直接用注释那句
-        var firstTop = 3 // 最上面一个距离顶部占比2%
-        var lastBottom = 2 // 最上面一个距离顶部占比2%
-        var itemPadding = 3 // 图形之间间隔占比1%
-        var itemHP = (100 - firstTop - lastBottom - itemPadding * (paramslength - 1)) / paramslength // 每一个图形占比
+        var firstTop = 54 // 最上面一个距离顶部占比20px
+        var lastBottom = 20 // 最上面一个距离顶部占比20px
+        var itemPadding = 30 // 图形之间间隔占比15px
+        var itemHP = (_this.echartsHeight - firstTop - lastBottom - itemPadding * (paramslength - 1)) / paramslength // 每一个图形高度
         if(paramscount === 0){
-          grid.push({left: leftValue, top: firstTop + "%", bottom: (lastBottom + ((itemHP + itemPadding) * (paramslength - (paramscount + 1)))) + "%"});
+          grid.push({left: leftValue, top: firstTop, bottom: (lastBottom + ((itemHP + itemPadding) * (paramslength - (paramscount + 1))))});
         } else if (paramscount === (paramslength - 1)){
-          grid.push({left: leftValue, top: (firstTop + (itemHP + itemPadding) * paramscount) + "%", bottom: lastBottom + "%"});
+          grid.push({left: leftValue, top: (firstTop + (itemHP + itemPadding) * paramscount), bottom: lastBottom});
         } else {
-          grid.push({left: leftValue, top: (firstTop + (itemHP + itemPadding) * paramscount) + "%", bottom: (lastBottom + (itemHP + itemPadding) * (paramslength - (paramscount + 1))) + "%"});
+          grid.push({left: leftValue, top: (firstTop + (itemHP + itemPadding) * paramscount), bottom: (lastBottom + (itemHP + itemPadding) * (paramslength - (paramscount + 1)))});
         }
         // grid.push({left: leftValue, top: (0.02 + paramscount / paramslength) * 100 + "%", bottom: (1.01 - (paramscount + 1) / paramslength) * 100 + "%"});;
         console.log(grid)