Jelajahi Sumber

修复数据中心

宇宙无敌M1处理器的MacBook Pro 4 tahun lalu
induk
melakukan
ce4b07afbd

+ 116 - 20
mini/pages/data-center/index.js

xqd xqd xqd
@@ -31,8 +31,8 @@ function initChart(canvas, width, height, dpr) {
     },
     series: [{
       data: [],
-      type: 'bar'
-    }]
+      type: 'bar',
+    }],
   };
 
   chart.setOption(option);
@@ -285,28 +285,125 @@ Page({
     option.legend = {
       data: data.legends
     }
-
     var type = this.data.charts[this.data.chartIndex].type
+    console.log(type)
     if (type == 'pie') {
-      option.series = [{
-        data: data.data,
-        type: type,
-        label: {
-          position: 'inner',
-          formatter: '{b}\n{d}%'
-        }
-      }]
+      console.log(data)
+      // option.series = [{
+      //   data: data.data,
+      //   type: type,
+      //   label: {
+      //     position: 'inner',
+      //     formatter: '{b}\n{d}%'
+      //   }
+      // }]
       option.xAxis.show = false
+      option = {
+        legend: {
+          orient: "vertical",
+          left: "left",
+          data: data.legends
+        },
+        series: [{
+          type: type,
+          data: data.data
+        }],
+        width:"100%",
+        xAxis:{},
+        yAxis: {},
+        tooltip: {},
+        grid: {},
+      }
     } else if (type == 'radar') {
       option.xAxis.show = false
-      option.radar = {
-        // shape: 'circle',
-        indicator: data.indicator
+      option = {
+        legend: {
+          data: data.legends
+        },
+        radar: {
+          // shape: 'circle',
+          indicator: data.indicator
+        },
+        series: [{
+          type: type,
+          data: data.data
+        }],
+        xAxis:{},
+        yAxis: {},
+        tooltip: {},
+      }
+    } else if (type == 'line') {
+      option.xAxis.show = true
+      option = {
+        xAxis: {
+          type: "category",
+          data: data.legends,
+          axisLabel: {
+            color: "#000",
+            interval: 0,
+            formatter: function (value) {
+              if (value.length > 4) {
+                return value.substring(0, 4) + "...";
+              } else {
+                return value;
+              }
+            }
+          },
+        },
+        yAxis: {},
+        series: [{
+          data: data.values.flat(),
+          type: type
+        }],
+        tooltip: {
+          show: true,
+          trigger: 'axis',
+          triggerOn: 'click',
+          axisPointer: {
+            type: 'cross',
+            axis: "x",
+          },
+          showContent: false
+        },
+        grid: {
+          left: '15%'
+        },
+      }
+    } else if (type == 'bar') {
+      option = {
+        xAxis: {
+          data: data.legends,
+          axisLabel: {
+            color: "#000",
+            interval: 0,
+            formatter: function (value) {
+              if (value.length > 4) {
+                return value.substring(0, 4) + "...";
+              } else {
+                return value;
+              }
+            }
+          },
+        },
+        yAxis: {},
+        series: [{
+          type: type,
+          data: data.values.flat()
+        }],
+        tooltip: {
+          show: true,
+          trigger: 'axis',
+          triggerOn: 'click',
+          axisPointer: {
+            type: 'cross',
+            axis: "x",
+          },
+          showContent: false
+        },
+        grid: {
+          left: '15%'
+        },
       }
-      option.series = [{
-        type: type,
-        data: data.data
-      }]
     } else {
       option.xAxis.show = true
       var values = data.values
@@ -322,8 +419,7 @@ Page({
         }
       }
     }
-
-    chart.setOption(option)
+    chart.setOption(option, true)
   },
 
   radioChange: function (e) {

+ 1 - 1
mini/pages/data-center/index.wxml

xqd
@@ -73,7 +73,7 @@
         </view>
       </view>
       <view class="sg-chart">
-        <block wx:if="{{chartIndex == 3}}">
+        <block wx:if="{{chartIndex == 4}}">
           <detail-table data="{{detail_data}}"></detail-table>
         </block>
         <block wx:else>

+ 1 - 0
mini/pages/filter-data/index.js

xqd
@@ -90,6 +90,7 @@ Page({
     var val = e.detail
     var items = this.data[name]
     items[index] = val
+    console.log(items)
     this.setData({
       [name]: items
     })

+ 3 - 3
mini/utils/env.js

xqd
@@ -1,3 +1,3 @@
-const isTest = false;
-export const baseUrl = isTest ? 'http://172.31.31.144/api/mini/' : 'https://t18.9026.com/api/mini/';
-export const imgHost = isTest ? 'http://172.31.31.144/images/' : 'https://t18.9026.com/images/'
+const isTest = true;
+export const baseUrl = isTest ? 'http://172.31.31.35/api/mini/' : 'https://t18.9026.com/api/mini/';
+export const imgHost = isTest ? 'http://172.31.31.35/images/' : 'https://t18.9026.com/images/'