diff --git a/src/components/scDegra.vue b/src/components/scDegra.vue index a1a538e4..fb7def1d 100644 --- a/src/components/scDegra.vue +++ b/src/components/scDegra.vue @@ -60,7 +60,7 @@ export default { if(that.g!==null){ that.updateGraph(); }else{ - that.g = new dagreD3.graphlib.Graph().setGraph({ + that.g = new dagreD3.graphlib.Graph({multigraph: true}).setGraph({ rankdir: that.rankdir, nodesep: 40, edgesep: 25, //两条线之间的距离 @@ -89,8 +89,9 @@ export default { that.edges.forEach((transition0) => { that.g.setEdge(transition0.source,transition0.target,{ label: transition0.label,// 边标签 + id: transition0.id, style: "fill:#ffffff;stroke:#c0c1c3;stroke-width:1.5px", // 根据后台数据来改变连线的颜色 - }); + },transition0.id); }); // 创建渲染器 let render = new dagreD3.render(); diff --git a/src/views/template/degraD3.vue b/src/views/template/degraD3.vue index 8c245af7..b613ac6d 100644 --- a/src/views/template/degraD3.vue +++ b/src/views/template/degraD3.vue @@ -60,7 +60,7 @@ export default { if(that.g!==null){ that.updataGraph(); }else{ - that.g = new dagreD3.graphlib.Graph().setGraph({ + that.g = new dagreD3.graphlib.Graph({multigraph: true,}).setGraph({ rankdir: that.rankdir, nodesep: 40, edgesep: 25, //两条线之间的距离 @@ -89,8 +89,9 @@ export default { that.edges.forEach((transition0) => { that.g.setEdge(transition0.source,transition0.target,{ label: transition0.label,// 边标签 + id: transition0.id, style: "fill:#ffffff;stroke:#c0c1c3;stroke-width:1.5px", // 根据后台数据来改变连线的颜色 - }); + }, transition0.id); }); // 创建渲染器 let render = new dagreD3.render();