diff --git a/editor.js b/editor.js index b612b6a..0219a78 100644 --- a/editor.js +++ b/editor.js @@ -45,14 +45,15 @@ function openSearchMenu(menuitem) { } // Workflow processing - -var workflow = {} +var workflow = {}; +const wfGraph = ForceGraph(); fetch('http://localhost:8080/test.json') .then((response) => response.json()) .then((data) => { for (var key in data) workflow[key] = data[key]; + wfGraph(document.getElementById('graph')).graphData({nodes: workflow.states, links: workflow.actions}); runnn(); }); @@ -277,15 +278,13 @@ var overlappingEdges = {}; // All edges whose target and source are connected const selfLoopCurvMin = 0.5; // Minimum curvature of a self loop. const curvatureMinMax = 0.2; // Minimum/maximum curvature (1 +/- x) of overlapping edges. -const wfGraph = ForceGraph() - /** * Updates the nodes and edges of the workflow graph. */ function updateGraph() { identifyOverlappingEdges() computeCurvatures() - wfGraph(document.getElementById('graph')).graphData({nodes: workflow.states, links: workflow.actions}); + wfGraph.graphData({nodes: workflow.states, links: workflow.actions}); } /**