echarts做圆环渐变进度条(饼图)
let myEcharts = echarts.init(this.$refs.caiji);
let option = {
title: {
text: '采集率%',
left: 'center',
top:'55%',
textStyle:{
color:'#999999',
fontSize: 13,
fontWeight:'400'
}
// bottom:'0'
},
//饼图中间显示文字
graphic: {
type: 'text',
left: 'center',
top: '30%',
style: {
text: this.caiji , //文字内容
// fill: "red",//文字颜色
fontSize: 30, //文字字号
fontWeight: '800',
fill:"#3478FF"
},
},
tooltip: {
trigger: 'item'
},
series: [
{
//第一张圆环
type: 'pie',
radius: ['80%', '100%'],
center: ['50%', '50%'],
// 隐藏指示线
labelLine: { show: false },
//隐藏圆环上文字
label: {
show: false
},
data: [
//value当前进度 + 颜色
{
value: this.caiji,
itemStyle: {
normal: {
color:new echarts.graphic.LinearGradient(
0, 0, 0, 1, [
{offset:0,color:'#4784FF'},
{offset:1,color:'#BFD9FF'}
])
}
}
},
{
value: 100-this.caiji,
itemStyle: {
normal: { color: '#D7D7D7' }
}
}
]
}
]
};
myEcharts.setOption(option)