关键参数
源码
let option = {
title: {
text: ''
},
tooltip: {
trigger: 'item'
},
legend: {
orient: 'vertical', // 设置图例的排列方向为垂直
right: 0, // 设置图例在图表的右侧
top: 'center', // 设置图例在图表中垂直居中
itemWidth: 5,
itemHeight: 5,
textStyle: { fontSize: 10, },
},
series: [
{
name: 'Access From',
type: 'pie',
left: "-30%",
radius: ['40%', '70%'],
avoidLabelOverlap: false,
itemStyle: {
borderRadius: 10,
borderColor: '#fff',
borderWidth: 2,
normal: {
color: function (colors) {
return colorList[colors.dataIndex];
}
},
},
label: {
show: false,
position: 'center'
},
emphasis: {
label: {
show: true,
fontSize: 40,
fontWeight: 'bold'
}
},
labelLine: {
show: false
},
data: []
}
]
};
///自适应
window.addEventListener("resize", function () {
countChart.resize();
areaChart.resize();
})