From 97ee1819fd359c3c784279131332b2f6ae6ac2c3 Mon Sep 17 00:00:00 2001 From: abhijeetmanhas <43112347+abhijeetmanhas@users.noreply.github.com> Date: Sun, 13 Jan 2019 00:40:35 +0530 Subject: [PATCH 1/5] Update graph.js --- app/js/graph.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/app/js/graph.js b/app/js/graph.js index 26b846c..3df425e 100644 --- a/app/js/graph.js +++ b/app/js/graph.js @@ -34,10 +34,30 @@ class Graph //Print the nodes console.log(this.cy.nodes()); } + addEdge(edge) + { + if ((edge == undefined) || (edge.name == undefined)) + { + return; + } + + this.cy.add({ + group: 'edges', + data: {name: edge.name,source:edge.source,target:edge.target}, + }).css({ + 'target-arrow-color':((edge.target-arrow-color ==undefined)? '#ccc':edge.target-arrow-color), + 'target-arrow-shape':((edge.target-arrow-shape ==undefined)? 'triangle':edge.target-arrow-shape), + 'line-color': ((edge.line-color == undefined) ? '#ccc' : edge.color), + 'width': ((edge.width == undefined) ? 3 : edge.width) + }); + + //Print the nodes + console.log(this.cy.edges()); + } } // An example for debugging // var g = new Graph('cy'); // console.log(g); // obj = {name:'saurabh', shape: 'octagon', color: 'cyan', width: '300px', height: '400px'}; -// g.addNode(obj); \ No newline at end of file +// g.addNode(obj); From c90a66b17710d83be7de9c9ede28f7a4f5ed085c Mon Sep 17 00:00:00 2001 From: abhijeetmanhas <43112347+abhijeetmanhas@users.noreply.github.com> Date: Sun, 13 Jan 2019 22:43:53 +0530 Subject: [PATCH 2/5] Update graph.js --- app/js/graph.js | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/app/js/graph.js b/app/js/graph.js index 3df425e..aefcdea 100644 --- a/app/js/graph.js +++ b/app/js/graph.js @@ -34,30 +34,14 @@ class Graph //Print the nodes console.log(this.cy.nodes()); } - addEdge(edge) + addEdge(source,target,index) { - if ((edge == undefined) || (edge.name == undefined)) - { - return; - } - this.cy.add({ - group: 'edges', - data: {name: edge.name,source:edge.source,target:edge.target}, - }).css({ - 'target-arrow-color':((edge.target-arrow-color ==undefined)? '#ccc':edge.target-arrow-color), - 'target-arrow-shape':((edge.target-arrow-shape ==undefined)? 'triangle':edge.target-arrow-shape), - 'line-color': ((edge.line-color == undefined) ? '#ccc' : edge.color), - 'width': ((edge.width == undefined) ? 3 : edge.width) + data: { + id: 'edge' + index, + source: source, + target: target + } }); - - //Print the nodes - console.log(this.cy.edges()); } } - -// An example for debugging -// var g = new Graph('cy'); -// console.log(g); -// obj = {name:'saurabh', shape: 'octagon', color: 'cyan', width: '300px', height: '400px'}; -// g.addNode(obj); From 9d0d9a845809d01ab9c3dc67051a666421fd0778 Mon Sep 17 00:00:00 2001 From: abhijeetmanhas <43112347+abhijeetmanhas@users.noreply.github.com> Date: Sun, 13 Jan 2019 22:45:42 +0530 Subject: [PATCH 3/5] Update graph.js --- app/js/graph.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/js/graph.js b/app/js/graph.js index aefcdea..38e11b5 100644 --- a/app/js/graph.js +++ b/app/js/graph.js @@ -45,3 +45,8 @@ class Graph }); } } +// An example for debugging +// var g = new Graph('cy'); +// console.log(g); +// obj = {name:'saurabh', shape: 'octagon', color: 'cyan', width: '300px', height: '400px'}; +// g.addNode(obj); From 786ac5a4dffc456da77663ac82f7e5757b1095f2 Mon Sep 17 00:00:00 2001 From: abhijeetmanhas <43112347+abhijeetmanhas@users.noreply.github.com> Date: Sun, 13 Jan 2019 23:16:34 +0530 Subject: [PATCH 4/5] Update graph.js --- app/js/graph.js | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/app/js/graph.js b/app/js/graph.js index 38e11b5..df34805 100644 --- a/app/js/graph.js +++ b/app/js/graph.js @@ -34,19 +34,24 @@ class Graph //Print the nodes console.log(this.cy.nodes()); } - addEdge(source,target,index) + addEdge(edge) { + if ((edge == undefined) || (edge.name == undefined) || (edge.source == undefined) || (edge.target == undefined)) + { + return; + } + this.cy.add({ - data: { - id: 'edge' + index, - source: source, - target: target - } + group: 'edges', + data: {name: edge.name,source:edge.source,target:edge.target}, + }).css({ + 'target-arrow-color':((edge.color ==undefined)? '#ccc':edge.target_arrow_color), + 'target-arrow-shape':((edge.shape ==undefined)? 'triangle':edge.shape), + 'line-color': ((edge.color == undefined) ? '#ccc' : edge.color), + 'width': ((edge.width == undefined) ? 3 : edge.width) }); + + //Print the nodes + console.log(this.cy.edges()); } } -// An example for debugging -// var g = new Graph('cy'); -// console.log(g); -// obj = {name:'saurabh', shape: 'octagon', color: 'cyan', width: '300px', height: '400px'}; -// g.addNode(obj); From 25d78299e08b57fe1c55af172bbfda60dc44575e Mon Sep 17 00:00:00 2001 From: abhijeetmanhas <43112347+abhijeetmanhas@users.noreply.github.com> Date: Mon, 14 Jan 2019 12:52:28 +0530 Subject: [PATCH 5/5] Update graph.js --- app/js/graph.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/js/graph.js b/app/js/graph.js index df34805..12bfbb4 100644 --- a/app/js/graph.js +++ b/app/js/graph.js @@ -45,7 +45,7 @@ class Graph group: 'edges', data: {name: edge.name,source:edge.source,target:edge.target}, }).css({ - 'target-arrow-color':((edge.color ==undefined)? '#ccc':edge.target_arrow_color), + 'target-arrow-color':((edge.color ==undefined)? '#ccc':edge.color), 'target-arrow-shape':((edge.shape ==undefined)? 'triangle':edge.shape), 'line-color': ((edge.color == undefined) ? '#ccc' : edge.color), 'width': ((edge.width == undefined) ? 3 : edge.width)