option = {
width: 200,
height: 250,
color: ['rgba(116,158,255,1.0)', 'rgba(116,158,255,0.7)', 'rgba(116,158,255,0.3)', 'rgba(116,158,255,0.1)'],
color1: ['rgba(255,118,118,1.0)', 'rgba(255,118,118,0.7)', 'rgba(255,118,118,0.3)', 'rgba(255,118,118,0.1)'],
color2: ['rgba(255,180,96,1.0)', 'rgba(255,180,96,0.7)', 'rgba(255,180,96,0.3)', 'rgba(255,180,96,0.1)'],
tooltip: {
trigger: 'item',
formatter: function(params) {
let html = '<div style="margin-top: 5px;margin-right: 5px;float: left; border-radius: 10px;width: 10px;height:10px;background-color: ' + params.color + '"></div>'
let _name = params.name.split('/')
return html + _name[0] + ': ' + params.percent + '%'
}
},
legend: {
bottom: '45%',
left: '2%',
orient: 'vertical',
icon: 'circle',
itemWidth: 20,
itemHeight: 12,
selectedMode: false,
formatter: function (name) {
let _name = name.split('/')
if (_name[0].length === 6) {
return _name[0] + ' ' + _name[2] + '%';
}
return _name[0] + ' ' + _name[2] + '%';
}
},
series: [
{
name: '用例统计',
type: 'pie',
radius: ['40%', '70%'],
avoidLabelOverlap: false,
itemStyle: {
borderRadius: 10,
borderColor: '#fff',
borderWidth: 2
},
label: {
show: true,
position: 'center',
fontWeight: 'bolder',
fontSize: 15,
formatter: function (params) {
//let _name = params.name.split('/')
//return _name[0];
return '测试统计';
}
},
emphasis: {
label: {
show: true,
fontSize: 15,
fontWeight: 'bold',
formatter: function (params) {
//let _name = params.name.split('/')
//return _name[0];
return '测试统计';
}
},
},
labelLine: {
show: false
},
data: [
{value: 1048, name: '系统集成测试/1048/36.81'},
{value: 735, name: '系统测试/735/25.82'},
{value: 580, name: '验收测试/580/20.37'},
{value: 484, name: '冒烟测试/484/17'}
]
}
]
};
Echarts【参考】B01.饼状图
最新推荐文章于 2023-03-31 18:02:44 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)