Browse Source

feat:切换时间时调用chart接口

liujing 8 months ago
parent
commit
3e4a7cc12f

+ 8 - 5
src/views/service/InterfaceDetail/components/LineCharts.vue

@@ -27,6 +27,7 @@ export default {
                 if (newValue){
                     this.subListQuery.start_time= newValue.startTime;
                     this.subListQuery.end_time= newValue.endTime;
+                    this.drawEchartsScale()
                 }
             }
         }
@@ -81,8 +82,10 @@ export default {
                 // 6: 'HTTP Status 5xx Percent Per Minute(%)',
             }
             for(let i = 1; i <=3; i++){
-                this[`myChartScale${i}`] = this.$echarts5.init(document.getElementById(`chart${i}`));
-                this[`myChartScale${i}`].resize();
+                if(this[`myChartScale${i}`] == null) {
+                    this[`myChartScale${i}`] = this.$echarts5.init(document.getElementById(`chart${i}`));
+                    this[`myChartScale${i}`].resize();
+                }
                 const res = await this.getChartDataFn(obj[i])
                 if(res.code == 200){
                     let data = res.data
@@ -144,9 +147,9 @@ export default {
                     }
                 },
                 grid: {
-                    left: '3%',
-                    right: '6%',
-                    bottom: '3%',
+                    left: '2%',
+                    right: '8%',
+                    bottom: 0,
                     containLabel: true
                 },
                 xAxis: {

+ 3 - 3
src/views/service/InterfaceDetail/index.vue

@@ -213,9 +213,9 @@ export default {
           }
         },
         grid: {
-          left: '4%',
-          right: '6%',
-          bottom: '3%',
+          left: '2%',
+          right: '8%',
+          bottom: 0,
           containLabel: true
         },
         xAxis: {