这个提问题的提交代码好像不能放HTML和js语言 所以我没法上传代码了,但是大致需求是这样的,只要select值改变了就删掉之前的饼图再根据现在的select的值重画饼图, 求大神帮助,谢谢啦。
配置项如下
var BlueCollar = 20,
whiteCollar = 80;
var option = {
tooltip : {
trigger: 'item',
formatter: "{a} <br/> <span style='display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:#ffe325'></span> {b}: {d}%"
},
legend: {
orient: 'vertical',
left: 'left',
top: '30',
data: ['蓝领','白领']
},
series : [{
name: '蓝领/白领比例',
type: 'pie',
radius : ['30%', '75%'],//圆的内外半径
center: ['50%', '50%'],//圆的X,Y轴平移
data:[
{
value: BlueCollar,
name: '蓝领',
itemStyle:{//柱子颜色
normal:{color:'#00b8ee'}
}
},
{
value: whiteCollar,
name: '白领',
itemStyle:{//柱子颜色
normal:{color:'#fe9e25'}
}
}
],
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}],
animationDelay: function (idx) {
return idx * 10;
},
animationType : 'elasticOut',
animationEasing: 'elasticOut'
}