
设置圆环样式
const gaugeData = [
{
value: 20,
}
];
option = {
series: [
{
type: 'gauge',
showBackground: true,
startAngle: 90,
endAngle: -270,
pointer: {
show: false
},
progress: {
show: true,
overlap: false,
roundCap: true,
clip: false,
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: '#D46B08' },
{ offset: 1, color: '#FFD591' }
])
},
label: {
show: true,
backgroundColor: '#000',
color: '#F00',
},
},
axisLine: {
lineStyle: {
width: 40,
color: [[1, {
type: 'linear',
colorStops: [
{offset: 0, color: '#F00'},
]
}]]
}
},
splitLine: {
show: false,
distance: 0,
length: 10
},
axisTick: {
show: false
},
axisLabel: {
show: false,
distance: 50
},
data: gaugeData,
detail: {
valueAnimation: true,
offsetCenter: ['0%', '0%'],
fontSize: 40,
formatter: '{value}%'
}
},
{
name: '背景圆环',
z: 5,
backgroundColor: '#0a214b',
type: 'pie',
cursor: 'default',
center: ['50%', '50%'],
radius: ['79%', '80%'],
hoverAnimation: false,
legendHoverLink: false,
silent: true,
labelLine: {
normal: {
show: false
}
},
data: [
{
value: 0,
itemStyle: {
normal: {
borderWidth: 1,
borderColor: '#6E7079'
}
}
}
]
}
]
};