Browse Source

气象预测曲线图场站过多展示调整

zy 4 tháng trước cách đây
mục cha
commit
38240e5761
1 tập tin đã thay đổi với 18 bổ sung6 xóa
  1. 18 6
      cpp-ui/src/views/largeScreen/components/right-middle.vue

+ 18 - 6
cpp-ui/src/views/largeScreen/components/right-middle.vue

@@ -351,20 +351,31 @@ export default {
       }
       let option = JSON.parse(JSON.stringify(weatherLineOption))
       option.grid = {
-        top: '5%',
+        top: '20%',
         left: '3%',
         right: '3%',
         bottom: '5%',
       }
+      let legend = []
+      let series = []
       let index = 0;
+      option.tooltip.enterable = true
+      option.tooltip.formatter = function (params){
+        let str ='<div style="max-height: calc(55vh);overflow-y: auto">'
+        for(let param of params){
+          str = str +'<div class="flex justify-between"><div>'+param.marker+ param.seriesName+'</div><div class="ml-0 mr-0">'+param.value+'</div></div>'
+        }
+        str = str +'</div>'
+        return str
+
+      }
       this.$axios({url: '/largeScreenController/forecastNwpFull', method: 'get',params: queryParams}).then(response => {
         let stationObj = response.data
         for (let key in stationObj) {
           for (let i = 0; i < stationObj[key].length; i++) {
             stationObj[key][i] = stationObj[key][i] == -99 ? null : stationObj[key][i]
           }
-          option.legend.data.push(key)
-
+          legend.push(key)
           let sValue = {
             name: key,
             type: 'line',
@@ -378,13 +389,12 @@ export default {
                 width: 2
               }
             },
-            itemStyle: this.lineStyle[index].itemStyle,
+            itemStyle: this.lineStyle[index] !== undefined ? this.lineStyle[index].itemStyle:{},
             data: stationObj[key]
           }
-          option.series.push(sValue)
+          series.push(sValue)
           index++;
         }
-
         if(sessionStorage.getItem('screen-weather-type')){
           if (sessionStorage.getItem('screen-weather-type').includes('wind')){
             option.yAxis[0].name='m/s'
@@ -396,6 +406,8 @@ export default {
         }else{
           option.yAxis[0].name='m/s'
         }
+        option.legend.data = legend
+        option.series = series
         this.fullChart = this.$echarts.init(document.getElementById('weatherFullChart'));
         this.fullChart.setOption(option, true)
       }).catch(err => {