怎么实现环形图按照绘制的路径进行颜色渐变 而不是按照x y轴进行渐变
配置项如下
var option = {
series: [{
type: 'pie',
radius: ['80%', '85%'],
avoidLabelOverlap: false,
clockwise: false,
label: {
normal: {
show: true,
position: 'center',
textStyle: {
fontSize: '30',
fontWeight: 'bold'
}
},
emphasis: {
show: true,
textStyle: {
fontSize: '30',
fontWeight: 'bold'
}
}
},
data: [
{
value: 60,
itemStyle: {
normal: {
opacity: 1,
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: 'rgba(232, 9, 9, 1)' // 0% 处的颜色
}, {
offset: 1,
color: 'rgba(232, 9, 9, 0.1)' // 100% 处的颜色
}], false)
}
}
},
{
value: 60,
itemStyle: {
normal: {
color: '#FFF',
opacity: 0.5
}
}
}
]
}, {
type: 'pie',
radius: ['77%', '87%'],
avoidLabelOverlap: false,
clockwise: false,
label: {
normal: {
show: false,
position: 'center',
textStyle: {
fontSize: '30',
fontWeight: 'bold'
}
},
emphasis: {
show: true,
textStyle: {
fontSize: '30',
fontWeight: 'bold'
}
}
},
data: [
{
value: 100,
itemStyle: {
normal: {
color: 'red',
opacity: 0.1
}
}
}
]
}]
};