配置项如下
const strings = ["校园大数据", "舆情大数据", "用户分析",
"话题分析", "评论分析", "图书馆分析",
"借阅分析", "借阅排行", "图书收录", "图书分析"
];
const datas = strings.map(string => {
return {
name: string,
symbolSize: 60,
category: string === '校园大数据' ? '0' : '1',
}
});
const linkData = []
for (let i = 1; i < strings.length; i++) {
linkData.push({
source: '校园大数据',
target: strings[i],
value: i,
lineStyle: {
width: i,
curveness: 0.1
},
})
}
option = {
animation: false,
series: [{
type: 'graph',
layout: 'force',
force: {
repulsion: 1000,
edgeLength: 100,
layoutAnimation: false,
},
edgeLabel: {
verticalAlign: 'bottom',
normal: {
show: true,
textStyle: {
fontSize: 12,
color: '#334B5C'
},
formatter: "{c}"
}
},
roam: false,
label: {
normal: {
show: true
}
},
data: datas,
links: linkData,
categories: [{
name: '0',
symbolSize: 100
},
{
name: '1',
symbolSize: '20'
},
]
}]
}