**
echarts圆环图环形图数据传数据
**简单记一下,以便以后忘
chat1() {
var bgs=[];
//this.allDa[0]可以换你想要的数组
for(let i =0;i<this.allDa[0].length;i++){
bgs.push({
value:this.allDa[0][i].quantity,
name:this.allDa[0][i].name,
})
}
const myEchart = this.$echarts.init(document.getElementById('chat1'));
const optionChat = {
title: {
text: '部门分布饼图'
},
tooltip: {
trigger: 'item',
axisPointer: {
type: 'shadow'
}
},
legend: {
top: '5%',
left: 'center',
},
series: [
{
name: '饼图',
type: 'pie',
radius: ['40%', '70%'],
avoidLabelOverlap: false,
label: {
show: false,
position: 'center'
},
emphasis: {
label: {
show: true,
fontSize: 40,
fontWeight: 'bold'
}
},
labelLine: {
show: false
},
*data: bgs*
}
]
};
myEchart.setOption(optionChat);
},