export function getCooperationStaticOption(params) {
const arr = [
{value: 1048, name: `搜索引擎`},
{value: 735, name: '直接访问'},
{value: 580, name: '邮件营销'},
{value: 484, name: '联盟广告'},
{value: 300, name: '视频广告'}
]
let optionData = params.map((item, index) => {
return {
value: item.quotaValue,
name: item.bankName,
labelLineName: `${item.quotaValue}项目`,
itemStyle: { color: colors[index] },
}
})
return {
title: {
show: false,
},
tooltip: {
show: false,
},
legend: {
orient: 'vertical',
left: 'left',
bottom: '0px',
icon: 'rect',
itemWidth: 8,
itemHeight: 8,
textStyle: {
rich: {
a: {
fontSize: 12,
verticalAlign: 'top',
padding: [0, 0, 0, 0],
color: '#999999',
}
},
},
},
series: [
{
name: '访问来源',
type: 'pie',
radius: ['30%', '50%'],
center: ['50%', '40%'],
data: optionData,
label: {
formatter: (val) => {
return `${val.data.labelLineName}`
}
},
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
},
}
]
};
}
主要是修改series里的label的值。