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uNDU2NzIsLTMuNzEgNS4zMjE5MywtNi40MjY0MmMwLjg2NTM2LC0yLjcxNjU2IDAuNjI4NTcsLTUuNjQ5MDMgLTAuNjYyMDcsLTguMjAzMjhjLTEuMjkwNzksLTIuNTU0MjYgLTMuNTM5MDEsLTQuNTM5MjMgLTYuMjg4OTQsLTUuNTUyNjZjLTIuNzUwMDcsLTEuMDEzNDUgLTUuNzk2MzcsLTAuOTc5NTUgLTguNTIxNTIsMC4wOTQ4MWMtMi43MjUxMywxLjA3NDM2IC00LjkyNTMzLDMuMTA4ODIgLTYuMTU0NzQsNS42OTExMmMtMS4yMjk0MSwyLjU4MjMgLTEuMzk2MDcsNS41MTkzMiAtMC40NjYyMiw4LjIxNTg1bDAsLTAuMDAxNHptLTIuMjMwMSwyLjE4MTJsLTAuMDE0NSwtMC4wMTRsMC4wMDU4LC0wLjAwNTZjLTAuODI2NiwtMS43OTIgLTEuMjUyNTEsLTMuNzMyMTIgLTEuMjQ5OSwtNS42OTM4YzAsLTcuNzMyMjQgNi40OTE2NSwtMTQuMDAwMDQgMTQuNDk5OTksLTE0LjAwMDA0YzguMDA4MzUsMCAxNC41LDYuMjY3OCAxNC41LDE0LjAwMDA0YzAsNy43MzIyIC02LjQ5MTY1LDEzLjk5OTk5IC0xNC41LDEzLjk5OTk5Yy01LjkwMTQ5LDAgLTEwLjk3NjQ5LC0zLjQwMiAtMTMuMjQxMzksLTguMjg2NmwwLDB6Ii8+PC9nPjwvZz48ZGVmcz48ZmlsdGVyIGlkPSJzdmdfMV9ibHVyIj48ZmVHYXVzc2lhbkJsdXIgaW49IlNvdXJjZUdyYXBoaWMiIHN0ZERldmlhdGlvbj0iMC4xIi8+PC9maWx0ZXI+PC9kZWZzPjwvc3ZnPg==`;
option = {
title: {
bottom: '10%',
left: 'center',
text: `{a| 0% } 回款金额 : 46亿5432万 {a|100%}`,
textStyle: {
color: '#fff',
rich: {
a: {
color: '#5a5a89',
fontSize: 16,
},
},
},
},
graphic: {
elements: [
{
type: 'image',
z: 999,
style: {
image: GuageSVG,
width: 80,
height: 80,
},
left: 'center',
top: '30%',
},
],
},
series: [
// 是否正常
{
type: 'gauge',
radius: '50%',
pointer: {
show: false,
},
axisLine: {
show: false,
},
axisTick: {
show: false,
},
splitLine: {
show: false,
},
axisLabel: {
show: false,
},
detail: {
fontSize: 12,
color: '#5A5A89',
offsetCenter: ['0', '5%'],
formatter: (value) => {
return value > 20 ? '正常' : '异常';
},
},
data: [
{
value: 45.5,
},
],
},
// 主图
{
type: 'gauge',
startAngle: 200,
endAngle: -20,
min: 0,
max: 240,
splitNumber: 12,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
{
offset: 0,
color: '#7C3FFF',
},
{
offset: 0.5,
color: '#7C3FFF',
},
{
offset: 1,
color: '#02A3FF',
},
]),
},
},
progress: {
show: true,
roundCap: true,
width: 18,
},
pointer: {
show: false,
},
axisLine: {
roundCap: true,
lineStyle: {
width: 18,
},
},
axisTick: {
show: false,
},
splitLine: {
show: false,
},
axisLabel: {
show: false,
},
title: {
show: false,
},
detail: {
fontSize: 25,
color: '#fff',
offsetCenter: ['0', '25%'],
formatter: (value) => {
return `${value}%`;
},
},
data: [
{
value: 45.5,
},
],
},
// 总回款比例
{
type: 'gauge',
radius: '50%',
pointer: {
show: false,
},
axisLine: {
show: false,
},
axisTick: {
show: false,
},
splitLine: {
show: false,
},
axisLabel: {
show: false,
},
detail: {
fontSize: 14,
color: '#5A5A89',
offsetCenter: ['0', '70%'],
formatter: () => {
return '总回款比例';
},
},
data: [
{
value: 45.5,
},
],
},
],
};