From 6ef9e5189ac1888b8c4c504d5c5d3f431807ff56 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期六, 15 三月 2025 11:57:40 +0800
Subject: [PATCH] 修改电路试验单位
---
src/util/echarts.js | 162 ++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 151 insertions(+), 11 deletions(-)
diff --git a/src/util/echarts.js b/src/util/echarts.js
index 0842962..8ccd62b 100644
--- a/src/util/echarts.js
+++ b/src/util/echarts.js
@@ -30,16 +30,16 @@
},
},
grid: {
- top: '5%',
- left: '7%',
+ top: '25px',
+ left: '40px',
right: '3%',
- bottom: '7%',
+ bottom: '40px',
// containLabel: true
},
legend: {
show: true,
orient: 'horizontal',
- y:-5,
+ y:-2,
right:15,
itemWidth: 12,
itemHeight: 12,
@@ -69,6 +69,7 @@
}],
yAxis: [{
+ minInterval:1,
type: 'value',
min: 0,
splitNumber: 4,
@@ -83,7 +84,7 @@
},
axisLabel: {
color: 'rgba(43,48,52, 0.4)',
- margin: 30
+ margin: 20,
},
axisTick: {
show: false,
@@ -138,10 +139,10 @@
},
},
grid: {
- top: '5%',
- left: '7%',
- right: '2%',
- bottom: '7%',
+ top: '25px',
+ left: '40px',
+ right: '3%',
+ bottom: '40px',
// containLabel: true
},
xAxis: [{
@@ -164,6 +165,7 @@
}],
yAxis: [{
+ minInterval:1,
type: 'value',
min: 0,
splitNumber: 4,
@@ -178,7 +180,7 @@
},
axisLabel: {
color: 'rgba(43,48,52, 0.4)',
- margin: 30
+ margin: 20,
},
axisTick: {
show: false,
@@ -194,7 +196,7 @@
backgroundColor: '#fff',
tooltip: {
trigger: 'item',
- formatter: '{a} <br/>{b} : {c} ({d}%)'
+ formatter: '{a} <br/>{b} : {c}'
},
title: {
text: params.percentage,
@@ -263,6 +265,144 @@
]
};
chart.setOption(option);
+ },
+ drawGauge:function(chart,params){
+ let option = {
+ tooltip: {
+ formatter: "{a} <br/>{b} : {c}%"
+ },
+ toolbox: {
+ feature: {
+ restore: {},
+ saveAsImage: {}
+ }
+ },
+ series: [
+ {
+ type: 'gauge',
+ axisLine: {
+ lineStyle: {
+ width: 28,
+ color: [
+ [0.3, '#67e0e3'],
+ [0.7, '#37a2da'],
+ [1, '#fd666d']
+ ]
+ }
+ },
+ pointer: {
+ itemStyle: {
+ color: 'auto'
+ }
+ },
+ axisTick: {
+ distance: -28,
+ length: 8,
+ lineStyle: {
+ color: '#fff',
+ width: 2
+ }
+ },
+ splitLine: {
+ distance: -28,
+ length: 28,
+ lineStyle: {
+ color: '#fff',
+ width: 4
+ }
+ },
+ axisLabel: {
+ color: 'inherit',
+ distance: 40,
+ fontSize: 14
+ },
+ detail: {
+ valueAnimation: true,
+ formatter: '{value} %',
+ color: 'inherit',
+ textStyle: {
+ fontSize: 30,
+ align: 'center',
+ },
+ },
+ data: [
+ {
+ value: 70
+ }
+ ]
+ }
+ ]
+ };
+ chart.setOption(option,true);
+ },
+ drawPie0:function(chart,params){
+ const colorList = ['#F09595', '#A4EEDA','#F6C18B', '#86C1F4','#91A0FC','#59CB74', '#FBD444', '#7F6AAD', '#585247']
+ let option = {
+ title: {
+ text: '鎬诲伐鏃�',
+ textStyle: {
+ fontSize: 18,
+ color: '#000',
+ lineHeight: 20
+ },
+ textAlign: 'center',
+ left: '18.8%',
+ top: '45%'
+ },
+ tooltip: {
+ trigger: 'item',
+ },
+ legend: {
+ type: 'scroll',
+ orient: 'vertical',
+ right: '10%',
+ top: 'center',
+ itemGap: 30,
+ selectedMode: false,
+ icon: 'rect',
+ data: params.data.map((d) => d.name),
+ textStyle: {
+ color: '#3D3D3D',
+ fontSize:'12px',
+ rich: {
+ name: {
+ width: 60,
+ },
+ hours: {
+ width: 60,
+ },
+ penl: {
+ width: 60,
+ }
+ }
+ },
+ formatter(name) {
+ const item = params.data.find((d) => d.name === name);
+ return `{name|${item.name}}{hours|${item.value}灏忔椂}{penl|${item.penl}%}`
+ }
+ },
+ color: colorList,
+ series: [
+ {
+ name: '宸ユ椂',
+ type: 'pie',
+ radius: [60, 90],
+ center: ['20%', '50%'],
+ label: {
+ show: false
+ },
+ labelLine: {
+ show: false
+ },
+ itemStyle: {
+ borderWidth: 1,
+ borderColor: '#fff'
+ },
+ data: params.data,
+ }
+ ]
+ }
+ chart.setOption(option,true);
}
}
--
Gitblit v1.9.3