From 0587a1eab55c688ccb9c69c768c5fd247adb407c Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期四, 01 十二月 2022 17:08:08 +0800
Subject: [PATCH] 1.看板接入
---
src/utils/myEcharts.js | 266 +++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 195 insertions(+), 71 deletions(-)
diff --git a/src/utils/myEcharts.js b/src/utils/myEcharts.js
index edc7679..de20de6 100644
--- a/src/utils/myEcharts.js
+++ b/src/utils/myEcharts.js
@@ -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,
@@ -399,6 +400,7 @@
top: '10%',
containLabel: true
},
+ // animation: false, // 鍙栨秷鍔ㄧ敾
xAxis: {
show: false
},
@@ -421,7 +423,7 @@
color: function(value, index) {
return value === '0' ? 'transparent' : '#fff'
},
- fontSize: 18,
+ fontSize: 20,
// formatter: function(value, index) {
// return [
// '{lg|' + (index + 1) + '銆� }' + '{title|' + value + '} '
@@ -494,7 +496,7 @@
show: true,
position: 'right',
formatter: '{c}',
- fontSize: 14,
+ fontSize: 20,
color: '#fff'
// formatter: '{c}%',
}
@@ -800,6 +802,7 @@
var max = Math.ceil(255 / 10) * 10
const option = {
+ animation: false,
backgroundColor: 'transparent',
grid: {
left: '0%',
@@ -900,8 +903,9 @@
}
// 杞﹂棿璐ㄩ噺宸︿笅鍛ㄤ笉鑹�
-export function line02() {
+export function line02(dataX, dataY) {
return {
+ animation: false,
backgroundColor: 'transparent',
tooltip: {},
// title: {
@@ -933,34 +937,35 @@
borderColor: '#fff'
}
},
- xAxis: [{
- type: 'category',
- boundaryGap: true,
- axisLabel: {
- interval: 0,
- formatter: '{value}',
- fontSize: 14,
- margin: 20,
- textStyle: {
- color: colorX
- }
- },
- axisLine: {
- lineStyle: {
- color: '#032c58'
- }
- },
- splitLine: {
- show: false,
- lineStyle: {
- color: '#032c58'
- }
- },
- axisTick: {
- show: false
- },
- data: ['鍛ㄤ竴', '鍛ㄤ簩', '鍛ㄤ笁', '鍛ㄥ洓', '鍛ㄤ簲', '鍛ㄥ叚', '鍛ㄦ棩']
- }],
+ xAxis: [
+ {
+ type: 'category',
+ boundaryGap: true,
+ axisLabel: {
+ interval: 0,
+ formatter: '{value}',
+ fontSize: 18,
+ margin: 20,
+ textStyle: {
+ color: colorX
+ }
+ },
+ axisLine: {
+ lineStyle: {
+ color: '#032c58'
+ }
+ },
+ splitLine: {
+ show: false,
+ lineStyle: {
+ color: '#032c58'
+ }
+ },
+ axisTick: {
+ show: false
+ },
+ data: dataX
+ }],
yAxis: [
{
// max: 800,
@@ -969,7 +974,7 @@
type: 'value',
axisLabel: {
textStyle: {
- fontSize: 14,
+ fontSize: 18,
color: colorY
}
},
@@ -1015,7 +1020,8 @@
show: true,
position: 'top',
textStyle: {
- color: '#fff'
+ color: '#fff',
+ fontSize: 16
}
},
itemStyle: {
@@ -1043,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)]
}
// {
@@ -1088,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) => {
@@ -1119,6 +1127,7 @@
}
const option = {
+ animation: false,
backgroundColor: 'transparent',
grid: {
top: '0%',
@@ -1158,7 +1167,7 @@
title: {
width: 50,
align: 'right',
- fontSize: 18
+ fontSize: 20
}
}
}
@@ -1183,7 +1192,7 @@
align: 'left',
verticalAlign: 'center',
lineHeight: 40,
- fontSize: 18,
+ fontSize: 20,
formatter: function(value, index) {
return data[index].value + ''
}
@@ -1195,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: {
@@ -1242,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, ',')
@@ -1274,6 +1268,7 @@
}, 0)
const option = {
+ animation: false,
backgroundColor: bgColor,
color: color,
// tooltip: {
@@ -1286,13 +1281,13 @@
textStyle: {
rich: {
name: {
- fontSize: 18,
+ fontSize: 22,
fontWeight: 'normal',
color: '#fff',
padding: [10, 0]
},
val: {
- fontSize: 32,
+ fontSize: 22,
fontWeight: 'bold',
color: '#fff'
}
@@ -1357,7 +1352,7 @@
normal: {
// showAbove: false,
length: 20,
- length2: 45,
+ length2: 35,
lineStyle: {
color: '#fff'
}
@@ -1374,11 +1369,11 @@
padding: [0, -50, 25, -50],
rich: {
icon: {
- fontSize: 16,
+ fontSize: 18,
color: 'red'
},
name: {
- fontSize: 16,
+ fontSize: 18,
padding: [0, 10, 0, 4],
color: '#fff'
},
@@ -1394,3 +1389,132 @@
}
return option
}
+
+// 杞﹂棿鐢熶骇 鐢熶骇淇℃伅 鐢熶骇杩涘害 杩涘害鏉�
+export function progress(param1, param2) {
+// param1 鎶ュ伐鏁伴噺
+ // param2 浠诲姟鏁伴噺
+
+ // 鎷垮埌鏁版嵁涔嬪悗闇�瑕佽绠楀嚭鐩稿闀垮害 param2鐨勭浉瀵归暱搴︿负100
+ let relativeValue = ''// 鐩稿鍊� 缁胯壊鑳屾櫙
+
+ relativeValue = (param1 / param2) * 100
+ // 鐧惧垎姣旀暟鍊肩殑浣嶇疆
+ var position = 'right'
+ // if (param1 >= 50) {
+ // position = 'inside';
+ // } else if (param1 < 50) {
+ // position = 'right';
+ // }
+
+ var option = {
+ animation: false,
+ // animation: false, // 鍙栨秷鍔ㄧ敾
+ // animationDuration: 5000,
+ grid: {
+ top: 'center',
+ left: '0%',
+ right: '0%',
+ // height: '%',
+ // containLabel: false
+ containLabel: true
+
+ },
+ xAxis: {
+ type: 'value',
+ axisLabel: {
+ show: false
+ },
+ max: 100,
+ axisTick: {
+ show: false
+ },
+ axisLine: {
+ show: false
+ },
+ splitLine: {
+ show: false
+ }
+ },
+ yAxis: [{
+ type: 'category',
+ data: [],
+ axisLabel: {
+ show: false
+ },
+ axisTick: {
+ show: false
+ },
+ axisLine: {
+ show: false
+ },
+ splitLine: {
+ show: false
+ },
+ z: 10
+ }, {
+ type: 'category',
+ axisLabel: {
+ show: false
+ },
+ axisTick: {
+ show: false
+ },
+ axisLine: {
+ show: false
+ },
+ splitLine: {
+ show: false
+ },
+ data: []
+ }],
+ series: [{
+ name: '',
+ type: 'bar',
+ barWidth: '100%',
+ // barMaxWidth: '100%',
+ label: {
+ normal: {
+ show: true,
+ // position: ['24', '38%'],
+ position: (param1.toString() + param2.toString()).length <= 6 ? ['24', '38%'] : 'insideLeft',
+ // formatter: '{c} %',
+ formatter: param1 + '/' + param2,
+ textStyle: {
+ color: '#FFFFFF',
+ fontWeight: 'bold',
+ fontFamily: 'Microsoft YaHei',
+ fontSize: 18
+ }
+ }
+ },
+ itemStyle: {
+ normal: {
+ barBorderRadius: 5,
+ shadowBlur: 10,
+ shadowColor: '#111',
+ color: '#2FD04F'
+ }
+ },
+ // data: [param1],
+ data: [relativeValue],
+ z: 10
+ }, {
+ type: 'bar',
+ barWidth: '100%',
+ yAxisIndex: 1,
+ silent: true,
+ // barMaxWidth: '100%',
+ itemStyle: {
+ normal: {
+ barBorderRadius: 5,
+ color: '#42475B'
+ }
+ },
+ // data: [param2]
+ data: [100]
+ }]
+ }
+
+ return option
+}
--
Gitblit v1.9.3