From 87f75ea2869629fedf893942b767765eff40c597 Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Sun, 22 Mar 2020 16:30:35 +0100 Subject: very first graph displayed using cytoscape --- src/map.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/map.js (limited to 'src/map.js') diff --git a/src/map.js b/src/map.js new file mode 100644 index 0000000..5561250 --- /dev/null +++ b/src/map.js @@ -0,0 +1,9 @@ +import cytoscape from 'cytoscape'; + +let options = { + container: document.getElementById('graph'), +}; + +Object.assign(options, data); + +let cy = cytoscape(options); -- cgit v1.2.3 From 86d0185d570dbc896f9f438c12e133e8cdd83940 Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Mon, 23 Mar 2020 15:13:09 +0100 Subject: feat(graph): better layout with cose-bilkent --- src/map.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/map.js') diff --git a/src/map.js b/src/map.js index 5561250..5da0e57 100644 --- a/src/map.js +++ b/src/map.js @@ -1,4 +1,7 @@ import cytoscape from 'cytoscape'; +import coseBilkent from 'cytoscape-cose-bilkent'; + +cytoscape.use(coseBilkent); let options = { container: document.getElementById('graph'), -- cgit v1.2.3 From d17713051ca2fef29de8025fe876d417838cea7f Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Wed, 25 Mar 2020 19:53:38 +0100 Subject: graph look, add redirections, close #50 --- src/map.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/map.js') diff --git a/src/map.js b/src/map.js index 5da0e57..4723318 100644 --- a/src/map.js +++ b/src/map.js @@ -10,3 +10,23 @@ let options = { Object.assign(options, data); let cy = cytoscape(options); + +cy.on('tap', 'node', function() { + try { + // your browser may block popups + window.open(this.data('id')); + } catch (e) { + // fall back on url change + window.location.href = this.data('id'); + } +}); + +cy.on('cxttap', 'node', function() { + try { + // your browser may block popups + window.open(this.data('edit')); + } catch (e) { + // fall back on url change + window.location.href = this.data('edit'); + } +}); -- cgit v1.2.3