81 lines
1.5 KiB
JavaScript
81 lines
1.5 KiB
JavaScript
/*
|
|
* @Author: zhp
|
|
* @Date: 2024-05-07 10:25:10
|
|
* @LastEditTime: 2024-05-16 13:35:50
|
|
* @LastEditors: zhp
|
|
* @Description:
|
|
*/
|
|
export default function ({
|
|
// single = false,
|
|
colors = ['#2760FF', '#5996F7', '#8BC566', '#11FAF0','#F3C000'],
|
|
titleValue,
|
|
subtitle,
|
|
dataList,
|
|
}) {
|
|
return {
|
|
grid: {
|
|
left: 0,
|
|
right: 0,
|
|
bottom: 0,
|
|
top: 0,
|
|
containLabel: true,
|
|
},
|
|
// tooltip: {},
|
|
title: {
|
|
text: titleValue,
|
|
left: "47%",
|
|
top: "39%",
|
|
textAlign: "center",
|
|
textStyle: {
|
|
fontWeight: 600,
|
|
fontSize: 32,
|
|
color: "#fffd",
|
|
},
|
|
subtext: `\u2002${subtitle}\u2002`,
|
|
subtextStyle: {
|
|
fontSize: 14,
|
|
fontWeight: 100,
|
|
color: "#fffd",
|
|
align: "right",
|
|
},
|
|
},
|
|
// legend: {
|
|
// top: '5%',
|
|
// left: 'center'
|
|
// },
|
|
series: [
|
|
{
|
|
name: 'Access From',
|
|
type: 'pie',
|
|
center: ['50%', '50%'],
|
|
radius: ['50%', '80%'],
|
|
avoidLabelOverlap: false,
|
|
labelLine: {
|
|
show: false
|
|
},
|
|
label: {
|
|
show: false
|
|
},
|
|
data: dataList && dataList.length > 0 && dataList.map((item, index) => ({
|
|
name:item.name,
|
|
value: item.value,
|
|
itemStyle:{
|
|
color:{
|
|
type: 'linear',
|
|
x: 0,
|
|
y: 0,
|
|
x2: 0,
|
|
y2: 1,
|
|
global: false,
|
|
colorStops:[
|
|
{offset: 0,color:colors[index%5]},
|
|
{offset: 1,color:colors[index%5]+'33'}
|
|
]
|
|
}
|
|
}
|
|
}))
|
|
}
|
|
]
|
|
};
|
|
}
|