chore: modify tree graph demo

This commit is contained in:
elaine 2019-05-08 17:19:37 +08:00
parent 424b5fccec
commit c521b7926f

View File

@ -51,27 +51,32 @@
modes: {
default: ['collapse-expand', 'drag-canvas']
},
defaultNode: {
size: 16,
anchorPoints: [[0,0.5], [1,0.5]]
},
defaultEdge: {
shape: 'cubic-horizontal'
},
nodeStyle: {
default: {
fill: '#40a9ff',
stroke: '#096dd9'
}
},
edgeStyle: {
default: {
stroke: '#A3B1BF'
}
},
fitView: true,
layout: layouts.dendrogram
});
graph.node(node => {
return {
size: 16,
anchorPoints: [[0,0.5], [1,0.5]],
style: {
fill: '#40a9ff',
stroke: '#096dd9'
},
label: node.id,
labelCfg: {
position: node.children && node.children.length > 0 ? 'left' : 'right'
}
}
});
let i = 0;
graph.edge(() => {
i++;
return {
shape: 'cubic-horizontal',
color: '#A3B1BF',
label: i
}
});
const data = {
isRoot: true,
id: 'Root',