瀏覽代碼

调整图形样式

yuhan 2 月之前
父節點
當前提交
f3d3304b55
共有 1 個文件被更改,包括 16 次插入3 次删除
  1. 16 3
      src/views/module_tpm/equipmentRunStatis/realtime.vue

+ 16 - 3
src/views/module_tpm/equipmentRunStatis/realtime.vue

@@ -61,7 +61,7 @@ export default {
         date: '',
       },
       url: {
-        list: '/equipmentOnoff/equipmentOnoff/getEquipmentHistoryData',
+        list: '/equipmentOnoff/equipmentOnoff/getEquipmentHistoryDataDefault',
         listparams: '/tpmParams/tpmParams/queryByEquipId',
       },
       deviceOptions: [],
@@ -248,7 +248,8 @@ export default {
         _this.myChart.dispose(); // 销毁实例
       }
       _this.myChart = echarts.init(chartDom)
-      _this.echartsHeight = 4 * 300;
+      // _this.echartsHeight = 4 * 300;
+      _this.echartsHeight = _this.equipmentparams.length * 180;
       // 获取time
       _this.times = [];
       _this.mongodbdata.forEach((i) => {
@@ -267,7 +268,19 @@ export default {
       var paramscount = 0;
       var paramslength = _this.equipmentparams.length;
       _this.equipmentparams.forEach((item) => {
-        grid.push({left: leftValue, top: (0.05 + (paramscount) / paramslength) * 100 + "%", bottom: (1.05 - (paramscount + 1) / paramslength) * 100 + "%"});
+        // 加判断是为了最上和最下有点间距好看,也可以不判断直接用注释那句
+        var firstTop = 3 // 最上面一个距离顶部占比2%
+        var lastBottom = 2 // 最上面一个距离顶部占比2%
+        var itemPadding = 3 // 图形之间间隔占比1%
+        var itemHP = (100 - firstTop - lastBottom - itemPadding * (paramslength - 1)) / paramslength // 每一个图形占比
+        if(paramscount === 0){
+          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 + "%"});
+        } else {
+          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 + "%"});;
 
         xAxis.push({
           type: 'category',