You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
|
|
export default function splitOption(dataNodes = [],dataEdges=[]) {
|
|
|
|
let nodes = [];
|
|
|
|
dataNodes.forEach(ele => {
|
|
|
|
let obj = {
|
|
|
|
x: ele.x,
|
|
|
|
y: ele.y,
|
|
|
|
id: ele.id,
|
|
|
|
name: ele.name,
|
|
|
|
value: ele.value,
|
|
|
|
symbolSize: ele.symbolSize,
|
|
|
|
itemStyle: {
|
|
|
|
color: ele.color
|
|
|
|
}
|
|
|
|
};
|
|
|
|
nodes.push(obj)
|
|
|
|
})
|
|
|
|
let edges = [];
|
|
|
|
dataEdges.forEach(ele => {
|
|
|
|
let obj = {
|
|
|
|
source: ele.source,
|
|
|
|
target: ele.target
|
|
|
|
};
|
|
|
|
edges.push(obj);
|
|
|
|
})
|
|
|
|
return {
|
|
|
|
tooltip: {
|
|
|
|
trigger: "item",
|
|
|
|
color: "#333",
|
|
|
|
textStyle: {
|
|
|
|
color: "#333", //设置文字颜色
|
|
|
|
},
|
|
|
|
},
|
|
|
|
title: {
|
|
|
|
show: false,
|
|
|
|
text: 'NPM Dependencies'
|
|
|
|
},
|
|
|
|
animationDurationUpdate: 1500,
|
|
|
|
animationEasingUpdate: 'quinticInOut',
|
|
|
|
series: [
|
|
|
|
{
|
|
|
|
type: 'graph',
|
|
|
|
layout: 'none',
|
|
|
|
// progressiveThreshold: 700,
|
|
|
|
data: nodes,
|
|
|
|
links: edges,
|
|
|
|
emphasis: {
|
|
|
|
focus: 'adjacency',
|
|
|
|
label: {
|
|
|
|
position: 'right',
|
|
|
|
show: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
label: {
|
|
|
|
show: true,
|
|
|
|
color: '#333',
|
|
|
|
position: 'right',
|
|
|
|
formatter: '{b}'
|
|
|
|
},
|
|
|
|
labelLayout: {
|
|
|
|
hideOverlap: true
|
|
|
|
},
|
|
|
|
scaleLimit: {
|
|
|
|
min: 0.4,
|
|
|
|
max: 2
|
|
|
|
},
|
|
|
|
roam: true,
|
|
|
|
lineStyle: {
|
|
|
|
color: 'source',
|
|
|
|
width: 0.5,
|
|
|
|
curveness: 0.3,
|
|
|
|
opacity: 0.7
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|