From a169bda5b19db4714d2aa476504e58105228cc40 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期二, 30 五月 2023 18:01:55 +0800
Subject: [PATCH] 1.对接移动端

---
 src/utils/myEcharts.js |  381 +++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 317 insertions(+), 64 deletions(-)

diff --git a/src/utils/myEcharts.js b/src/utils/myEcharts.js
index 7f9b95f..7da088d 100644
--- a/src/utils/myEcharts.js
+++ b/src/utils/myEcharts.js
@@ -308,9 +308,9 @@
       }
     },
     yAxis: {
-      max: 1,
+      max: 10,
       min: 0,
-      interval: 0.2,
+      interval: 2,
       splitLine: {
         show: false
       },
@@ -375,6 +375,7 @@
   // const myColor = ['#7af5f5', '#00FFFF', '#00FFFF', '#00FFFF', '#00FFFF']
   const myColor = ['rgba(122,245,245,1)', 'rgba(122,245,245,0.95)', 'rgba(122,245,245,0.9)', 'rgba(122,245,245,0.85)', 'rgba(122,245,245,0.8)']
   const option = {
+    animation: false,
     backgroundColor: 'transparent',
     title: {
       show: false,
@@ -393,8 +394,8 @@
       }
     },
     grid: {
-      left: '10%',
-      right: '5%',
+      left: '5%',
+      right: '10%',
       bottom: '0%',
       top: '10%',
       containLabel: true
@@ -801,6 +802,7 @@
   var max = Math.ceil(255 / 10) * 10
 
   const option = {
+    animation: false,
     backgroundColor: 'transparent',
     grid: {
       left: '0%',
@@ -901,8 +903,9 @@
 }
 
 // 杞﹂棿璐ㄩ噺宸︿笅鍛ㄤ笉鑹�
-export function line02() {
+export function line02(dataX, dataY) {
   return {
+    animation: false,
     backgroundColor: 'transparent',
     tooltip: {},
     // title: {
@@ -961,7 +964,7 @@
         axisTick: {
           show: false
         },
-        data: ['鍛ㄤ竴', '鍛ㄤ簩', '鍛ㄤ笁', '鍛ㄥ洓', '鍛ㄤ簲', '鍛ㄥ叚', '鍛ㄦ棩']
+        data: dataX
       }],
     yAxis: [
       {
@@ -1046,7 +1049,7 @@
             shadowBlur: 20 // shadowBlur璁惧浘褰㈤槾褰辩殑妯$硦澶у皬銆傞厤鍚坰hadowColor,shadowOffsetX/Y, 璁剧疆鍥惧舰鐨勯槾褰辨晥鏋溿��
           }
         },
-        data: [393, 438, 485, 631, 689, 824, 700]
+        data: dataY
         // data: [600 + Math.floor(Math.random() * 100), 600 + Math.floor(Math.random() * 100), 600 + Math.floor(Math.random() * 100), 600 + Math.floor(Math.random() * 100), 600 + Math.floor(Math.random() * 100), 600 + Math.floor(Math.random() * 100), 600 + Math.floor(Math.random() * 100)]
       }
       //   {
@@ -1091,23 +1094,25 @@
 }
 
 // 杞﹂棿璐ㄩ噺鍙充笂 鏃ヤ笉鑹�
-export function bar04() {
+export function bar04(resValueArr) {
+  // let data = resValueArr.map(({ eqp_name, cont }) => ({ name: eqp_name, value: cont }))//鏇挎崲鏁扮粍瀵硅薄涓殑閿悕
+
   const data = [
     {
-      name: '浜х嚎涓�',
-      value: 100
+      name: '瑁呴厤涓�绾�',
+      value: resValueArr.find(i => i.eqp_name === '瑁呴厤涓�绾�') ? resValueArr.find(i => i.eqp_name === '瑁呴厤涓�绾�').cont : 0
     },
     {
-      name: '浜х嚎浜�',
-      value: 200
+      name: '瑁呴厤浜岀嚎',
+      value: resValueArr.find(i => i.eqp_name === '瑁呴厤浜岀嚎') ? resValueArr.find(i => i.eqp_name === '瑁呴厤浜岀嚎').cont : 0
     },
     {
-      name: '浜х嚎涓�',
-      value: 64
+      name: '瑁呴厤涓夌嚎',
+      value: resValueArr.find(i => i.eqp_name === '瑁呴厤涓夌嚎') ? resValueArr.find(i => i.eqp_name === '瑁呴厤涓夌嚎').cont : 0
     },
     {
-      name: '浜х嚎鍥�',
-      value: 44
+      name: '瑁呴厤鍥涚嚎',
+      value: resValueArr.find(i => i.eqp_name === '瑁呴厤鍥涚嚎') ? resValueArr.find(i => i.eqp_name === '瑁呴厤鍥涚嚎').cont : 0
     }
   ]
   const getSymbolData = (data) => {
@@ -1122,6 +1127,7 @@
   }
 
   const option = {
+    animation: false,
     backgroundColor: 'transparent',
     grid: {
       top: '0%',
@@ -1198,7 +1204,10 @@
         name: 'XXX',
         type: 'pictorialBar',
         symbol: 'image://data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADoAAAA6CAMAAADWZboaAAAAZlBMVEUAAABe3uVe3+Vf3uVf3+Zf3uVg3+Zg3+Zf3+Vi4OZh4OZg3+Z86/Bh3+Zi4Odj4Odi4OZ86/B76/B86/Bj4ed56+9x5+xn4umB7/N87PB36e+A7/N+7fF/7vJ/7vJ+7fGA7/OB7/PReX+lAAAAIXRSTlMABQkVDREmIhk3MR10LEFFPHh7cUprXE35h2XnqMLAp+mHAG9cAAAB5ElEQVRIx83WjU7CMBQFYIoiKMqU/XUboHv/l/Tce7t2XamDNSacETEmX86tlK2rx4py150o+MstMBLwWRfHKo6JCVxLnvmFGBjFQ58oF1//sUZhGy/ClSTWObgnL4O+bkeN4nY2okfNMbkRt9/vtxz8InoTsWplJSCzFxPmO8+GpSIByX3YQAuGDWtRKhKjCnxDXhF6Z4yxnZ20Wgko7BMRDmxtSGVaI4kdTIgb+zTYoJQlIMlDlmUFgrcDWWC201qSayqlTkiCddWWeV62VU0YlnpRi9VOKaSUsiyq/N0krwq2Ugt7lVpZl5BfHNiytjagMi+XYp0kCR45hMlivVQrE/uU5pXSrCB5bM6d1t2lOZItMqmliT3q5uVxqxzyW/ccfYLNKx7ZTeykMvNyac2yt2Fbc61MHLSC0rwoxbiNdlQ3GBm1NLHQsHUrtEXppR/ljNpW6DbSCoqlFiVoN6YdaFlgsSFVPs1BdT8OaB5QyQzVcaqWDows/zepxR8ObLglTrdtCRVuRNj4Rrxh+//0ke2f8KVL+Kon3GCSbmsJN9OUW3j6g0Ns+LgCij2u0h+Sghc8mlMPBMgdx5DFh59VmOVHrvmDnoNxCz3J7MFWsMuaLyR089xz/xhlfijvwutR8gv3zk6BLUUeCgAAAABJRU5ErkJggg==',
-        symbolSize: [50, 50],
+        // symbolSize: [50, 50],
+        symbolSize: function(params) {
+          return params === 0 ? [0, 0] : [50, 50]
+        },
         symbolOffset: [20, 0],
         z: 12,
         itemStyle: {
@@ -1222,22 +1231,22 @@
             color: 'rgba(41, 162, 245, 1)',
             barBorderRadius: 10
           }
-        // color: '#A71A2B',
-        // barBorderRadius: 4,
+          // color: '#A71A2B',
+          // barBorderRadius: 4,
         }
-      // label: {
-      //     normal: {
-      //         color: '#fff',
-      //         show: true,
-      //         position: ["-80px", 0],
-      //         textStyle: {
-      //             fontSize: 16
-      //         },
-      //         formatter: function(a, b) {
-      //             return a.name
-      //         }
-      //     }
-      // }
+        // label: {
+        //     normal: {
+        //         color: '#fff',
+        //         show: true,
+        //         position: ["-80px", 0],
+        //         textStyle: {
+        //             fontSize: 16
+        //         },
+        //         formatter: function(a, b) {
+        //             return a.name
+        //         }
+        //     }
+        // }
       }]
   }
 
@@ -1245,29 +1254,11 @@
 }
 
 // 杞﹂棿璐ㄩ噺鍙充笅  鍛ㄤ笉鑹�
-export function pie02() {
+export function pie02(resValueArr) {
   const bgColor = 'transparent'
   const title = '鎬讳笉鑹暟'
   const color = ['#0E7CE2', '#FF8352', '#E271DE', '#F8456B', '#00FFFF', '#4AEAB0']
-  const echartData = [
-    {
-      name: '浜х嚎涓�',
-      value: '456'
-    },
-    {
-      name: '浜х嚎浜�',
-      value: '123'
-    },
-    {
-      name: '浜х嚎涓�',
-      value: '312'
-    },
-    {
-      name: '浜х嚎鍥�',
-      value: '222'
-    }
-  ]
-
+  const echartData = resValueArr.map(({ eqp_name, cont }) => ({ name: eqp_name, value: cont }))// 鏇挎崲鏁扮粍瀵硅薄涓殑閿悕
   const formatNumber = function(num) {
     const reg = /(?=(\B)(\d{3})+$)/g
     return num.toString().replace(reg, ',')
@@ -1277,6 +1268,7 @@
   }, 0)
 
   const option = {
+    animation: false,
     backgroundColor: bgColor,
     color: color,
     // tooltip: {
@@ -1302,16 +1294,16 @@
         }
       }
     }
-    // {
-    //   text: '鍗曚綅锛氫釜',
-    //   top: 20,
-    //   left: 20,
-    //   textStyle: {
-    //     fontSize: 14,
-    //     color: '#666666',
-    //     fontWeight: 400
-    //   }
-    // }
+      // {
+      //   text: '鍗曚綅锛氫釜',
+      //   top: 20,
+      //   left: 20,
+      //   textStyle: {
+      //     fontSize: 14,
+      //     color: '#666666',
+      //     fontWeight: 400
+      //   }
+      // }
     ],
     // legend: {
     //     orient: 'vertical',
@@ -1360,7 +1352,7 @@
           normal: {
             // showAbove: false,
             length: 20,
-            length2: 45,
+            length2: 35,
             lineStyle: {
               color: '#fff'
             }
@@ -1371,7 +1363,7 @@
             formatter: params => {
               return (
                 '{icon|鈼弣{name|' + params.name + '}{value|' +
-              formatNumber(params.value) + '}'
+                formatNumber(params.value) + '}'
               )
             },
             padding: [0, -50, 25, -50],
@@ -1416,6 +1408,7 @@
   // }
 
   var option = {
+    animation: false,
     // animation: false, // 鍙栨秷鍔ㄧ敾
     // animationDuration: 5000,
     grid: {
@@ -1525,3 +1518,263 @@
 
   return option
 }
+
+// 閲囪喘璁㈠崟
+export function cgddchart(data1, data2, data3) {
+  // 寰楀埌鏈�澶у��  5鐨勫�嶆暟
+
+  let max = Math.max(Math.max(data1, data2), data3) + 5
+  if (max % 5 !== 0) {
+    max = 5 - max % 5 + max
+  }
+  const option = {
+    backgroundColor: 'transparent',
+    tooltip: {
+      formatter: '{a} <br/>{c} {b}'
+    },
+    series: [
+      {
+        name: '鏈湀閲囪喘璁㈠崟鏁�',
+        type: 'gauge',
+        color: ['#f00'],
+        min: 0,
+        max: max,
+        splitNumber: 5,
+        radius: '70%',
+        center: ['17%', '48%'],
+        axisLine: { // 鍧愭爣杞寸嚎
+          lineStyle: { // 灞炴�ineStyle鎺у埗绾挎潯鏍峰紡
+            width: 10,
+            color: [
+              [0.4, '#09d8f2'],
+              [1, '#00FFFFF']
+            ]
+          },
+          backgroundColor: 'none'
+        },
+        tooltip: {
+          show: false
+        },
+        axisTick: { // 鍧愭爣杞村皬鏍囪
+          length: 10, // 灞炴�ength鎺у埗绾块暱
+          lineStyle: { // 灞炴�ineStyle鎺у埗绾挎潯鏍峰紡
+            color: 'auto'
+          }
+        },
+        splitLine: { // 鍒嗛殧绾�
+          length: 10, // 灞炴�ength鎺у埗绾块暱
+          lineStyle: { // 灞炴�ineStyle锛堣瑙乴ineStyle锛夋帶鍒剁嚎鏉℃牱寮�
+            color: colorY
+          }
+        },
+        axisLabel: {
+          borderRadius: 1,
+          // color: 'rgba(255,255,255,0.7)',
+          color: '#00FFFF',
+          padding: 1,
+          fontSize: 18
+        },
+        title: {
+          // 鍏朵綑灞炴�ч粯璁や娇鐢ㄥ叏灞�鏂囨湰鏍峰紡锛岃瑙乀EXTSTYLE
+          // fontWeight: 'bolder',
+          fontSize: 22,
+          fontFamily: 'Microsoft YaHei',
+          fontColor: '#FFF',
+          color: '#FFF',
+          paddingTop: 20,
+          offsetCenter: [0, '120%']
+          // fontStyle: 'italic'
+        },
+        itemStyle: {
+          // color: '#1092ff'
+          color: '#09d8f2'
+        },
+        detail: {
+          shadowOffsetX: 0,
+          shadowOffsetY: 0,
+          fontFamily: 'digital',
+          fontSize: 26,
+          color: '#fff',
+          rich: {},
+          offsetCenter: [0, '90%'],
+
+          formatter: function(value) {
+            return value
+          }
+        },
+        data: [{
+          value: data1,
+          name: '鏈湀閲囪喘璁㈠崟鏁�'
+        }]
+      },
+      {
+        name: '鏈湀鍒拌揣鍗曟暟',
+        type: 'gauge',
+        color: ['#f00'],
+        min: 0,
+        max: max,
+        splitNumber: 5,
+        radius: '70%',
+        center: ['50%', '48%'],
+        axisLine: { // 鍧愭爣杞寸嚎
+          lineStyle: { // 灞炴�ineStyle鎺у埗绾挎潯鏍峰紡
+            width: 10,
+            color: [
+              [0.4, '#09d8f2'],
+              [1, '#00FFFFF']
+            ]
+          },
+          backgroundColor: 'none'
+        },
+        tooltip: {
+          show: false
+        },
+        axisTick: { // 鍧愭爣杞村皬鏍囪
+          length: 10, // 灞炴�ength鎺у埗绾块暱
+          lineStyle: { // 灞炴�ineStyle鎺у埗绾挎潯鏍峰紡
+            color: 'auto'
+          }
+        },
+        splitLine: { // 鍒嗛殧绾�
+          length: 10, // 灞炴�ength鎺у埗绾块暱
+          lineStyle: { // 灞炴�ineStyle锛堣瑙乴ineStyle锛夋帶鍒剁嚎鏉℃牱寮�
+            color: colorY
+          }
+        },
+        axisLabel: {
+          borderRadius: 1,
+          // color: 'rgba(255,255,255,0.7)',
+          color: '#00FFFF',
+          padding: 1,
+          fontSize: 18
+        },
+        title: {
+          // 鍏朵綑灞炴�ч粯璁や娇鐢ㄥ叏灞�鏂囨湰鏍峰紡锛岃瑙乀EXTSTYLE
+          // fontWeight: 'bolder',
+          fontSize: 22,
+          fontColor: '#FFF',
+          color: '#FFF',
+          fontFamily: 'Microsoft YaHei',
+          paddingTop: 20,
+          offsetCenter: [0, '120%']
+          // fontStyle: 'italic'
+        },
+        itemStyle: {
+          // color: '#1092ff'
+          color: '#09d8f2'
+        },
+        detail: {
+          shadowOffsetX: 0,
+          shadowOffsetY: 0,
+          // borderWidth: 1,
+          textBorderColor: '#000',
+          textBorderWidth: 1,
+          textShadowBlur: 1,
+          textShadowColor: colorY,
+          textShadowOffsetX: 0,
+          textShadowOffsetY: 0,
+          paddingTop: 10,
+          fontFamily: 'digital',
+          fontSize: 20,
+          width: 30,
+          color: '#fff',
+          rich: {},
+          offsetCenter: [0, '90%'],
+          formatter: function(value) {
+            // console.info(value)
+            // return (value * 10 + '%')
+            return value
+          }
+        },
+        data: [{
+          value: data2,
+          name: '鏈湀鍒拌揣鍗曟暟'
+        }]
+      },
+      {
+        name: '鏈湀閲囪喘鍏ュ簱鍗曟暟',
+        type: 'gauge',
+        color: ['#f00'],
+        min: 0,
+        max: max,
+        splitNumber: 5,
+        radius: '70%',
+        center: ['83%', '48%'],
+        axisLine: { // 鍧愭爣杞寸嚎
+          lineStyle: { // 灞炴�ineStyle鎺у埗绾挎潯鏍峰紡
+            width: 10,
+            color: [
+              [0.4, '#09d8f2'],
+              [1, '#00FFFFF']
+            ]
+          },
+          backgroundColor: 'none'
+        },
+        tooltip: {
+          show: false
+        },
+        axisTick: { // 鍧愭爣杞村皬鏍囪
+          length: 10, // 灞炴�ength鎺у埗绾块暱
+          lineStyle: { // 灞炴�ineStyle鎺у埗绾挎潯鏍峰紡
+            color: 'auto'
+          }
+        },
+        splitLine: { // 鍒嗛殧绾�
+          length: 10, // 灞炴�ength鎺у埗绾块暱
+          lineStyle: { // 灞炴�ineStyle锛堣瑙乴ineStyle锛夋帶鍒剁嚎鏉℃牱寮�
+            color: colorY
+          }
+        },
+        axisLabel: {
+          borderRadius: 1,
+          // color: 'rgba(255,255,255,0.7)',
+          color: '#00FFFF',
+          padding: 1,
+          fontSize: 18
+        },
+        title: {
+          // 鍏朵綑灞炴�ч粯璁や娇鐢ㄥ叏灞�鏂囨湰鏍峰紡锛岃瑙乀EXTSTYLE
+          // fontWeight: 'bolder',
+          fontSize: 22,
+          fontColor: '#FFF',
+          color: '#FFF',
+          fontFamily: 'Microsoft YaHei',
+          paddingTop: 20,
+          offsetCenter: [0, '120%']
+          // fontStyle: 'italic'
+        },
+        itemStyle: {
+          // color: '#1092ff'
+          color: '#09d8f2'
+        },
+        detail: {
+          shadowOffsetX: 0,
+          shadowOffsetY: 0,
+          // borderWidth: 1,
+          textBorderColor: '#000',
+          textBorderWidth: 1,
+          textShadowBlur: 1,
+          textShadowColor: colorY,
+          textShadowOffsetX: 0,
+          textShadowOffsetY: 0,
+          paddingTop: 10,
+          fontFamily: 'digital',
+          fontSize: 20,
+          width: 30,
+          color: '#fff',
+          rich: {},
+          offsetCenter: [0, '90%'],
+          formatter: function(value) {
+            return value
+          }
+        },
+        data: [{
+          value: data3,
+          name: `鏈湀閲囪喘鍏ュ簱鍗曟暟`
+        }]
+      }
+
+    ]
+  }
+  return option
+}

--
Gitblit v1.9.3