彭宇 %!s(int64=2) %!d(string=hai) anos
pai
achega
33f427a979

+ 8 - 4
src/views/bigdata/chart-event.vue

@@ -102,7 +102,7 @@
         // 数据处理
         chartData.forEach((v, i) => {
           arrName.push(v.name);
-          arrValue.push(v.value);
+          arrValue.push(parseInt(v.value));
           sum = sum + v.value;
         });
 
@@ -123,7 +123,7 @@
             },
             data: [
               {
-                value: v.value,
+                value: parseInt(v.value),
                 name: v.name,
                 itemStyle: {
                   normal: {
@@ -133,7 +133,7 @@
                 }
               },
               {
-                value: sum - v.value,
+                value: parseInt(sum) - parseInt(v.value),
                 name: '',
                 itemStyle: {
                   color: 'rgba(0,0,0,0)',
@@ -173,7 +173,11 @@
               },
             ],
           });
-          v.percent = ((v.value / sum) * 100).toFixed(1) + '%';
+          if(parseInt(sum)==0||parseInt(v.value)==0){
+            v.percent = 0+ '%'
+          }else{
+            v.percent = ((parseInt(v.value) / parseInt(sum)) * 100).toFixed(1) + '%';
+          }
           lineYAxis.push({
             value: i,
             textStyle: {

+ 2 - 2
src/views/bigdata/chart-pollutionSource.vue

@@ -76,7 +76,7 @@
 
         option = {
           tooltip: {
-            formatter: '{b} : {c}' + '',
+            formatter: '{b} : {c}' + '',
           },
           grid: {
             left: '3%',
@@ -156,7 +156,7 @@
                         stuNum = value.value;
                       }
                     })
-                    return stuNum + '{white| }';
+                    return stuNum + '{white| }';
                   },
                   textStyle: {
                     color: "#ffc72b",