var equipment = ['项目1', '项目2', '项目3', '项目4'];
var colorList = ['#3ea1ff', '#88d1eb', '#3ccbcb', '#82dfbe'];
var option = {
backgroundColor: '#fff',
tooltip: {
formatter: function(param) {
return "<div style='width: 100px'>" + param.data.name + "<span style='float: right;'>" + param.value + '</span></div>' +
"<div>占比<span style='float: right;'>" + param.data.rate + '</span></div>';
}
},
legend: {
data: equipment,
orient: 'vertical',
icon: "circle",
// right: '5%',
right: 'left',
bottom: '30',
itemWidth: 10,
itemHeight: 10,
itemGap: 20,
textStyle: {
color: '#b2b2b2',
fontSize: 14,
},
},
series: [
{
name: '招标方式',
type: 'pie',
radius: ['50%', '80%'],
itemStyle: {
normal: {
color: function(params) {
return colorList[params.dataIndex]
},
borderColor: '#fff',
borderWidth: 5
}
},
label: {
normal: {
formatter: function(params) {
if (params.value > 0) {
return params.data.type
} else {
return ''
}
},
show: true
},
},
data: [
{
value: 135,
rate: '2%',
name: equipment[0],
},
{
value: 200,
rate: '2%',
name: equipment[1],
},
{
value: 100,
rate: '2%',
name: equipment[2],
},
{
value: 50,
rate: '6%',
name: equipment[3],
}
]
}
]
};
网友评论