饼图渐变
drawLine4() {
let myChart4 = this.$echarts.init(document.getElementById("myChart4"));
let option = {
tooltip: {
trigger: 'item'
},
legend: {
top: '5%',
left: 'center'
},
series: [
{
name: "完成率",
type: "pie",
radius: ["60%", "30%"],
avoidLabelOverlap: false,
itemStyle :{
normal : {
label : {
show : true,
position : 'center',
formatter : 20 + "%",
textStyle : {
color : '#3D414B',
fontSize : '30',
fontFamily : '微软雅黑',
fontWeight : 'bold'
}
},
labelLine : {
show : false
}
}
},
data: [
{
value: 60,
name: "完成",
itemStyle: {
normal: {//颜色渐变
color: new echarts.graphic.LinearGradient(
1, 1, 1, 0, //(上-下 渐变)
// 1, 1, 0, 0, //(左上-右下 渐变)
// 1, 0, 0, 0, //(左-右 渐变)
// 0, 1, 1, 0, //(右上-左下 渐变)
// 0, 1, 1, 1, //(左-右 渐变)
// 1, 0, 1, 1, //(上-下 渐变)
// 0, 0, 1, 0, //(左-右 渐变)
// 0, 0, 0, 1, //(上-下 渐变)
[
{offset: 0, color: '#FF4343'},
{offset: 0.5, color: '#8EED6E'},
{offset: 1, color: '#009FF4'},
]
)
}
}
},
{
value: 40,
name: "未完成"
}
]
}
],
};
myChart4.setOption(option);
},
},
};