-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdigraph_viz.html
108 lines (73 loc) · 5.5 KB
/
digraph_viz.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis.css" type="text/css" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis-network.min.js"> </script>
<center>
<h1></h1>
</center>
<!-- <link rel="stylesheet" href="../node_modules/vis/dist/vis.min.css" type="text/css" />
<script type="text/javascript" src="../node_modules/vis/dist/vis.js"> </script>-->
<style type="text/css">
#mynetwork {
width: 800px;
height: 600px;
background-color: #ffffff;
border: 1px solid lightgray;
position: relative;
float: left;
}
</style>
</head>
<body>
<div id = "mynetwork"></div>
<script type="text/javascript">
// initialize global variables.
var edges;
var nodes;
var network;
var container;
var options, data;
// This method is responsible for drawing the graph, returns the drawn network
function drawGraph() {
var container = document.getElementById('mynetwork');
// parsing and collecting nodes and edges from the python
nodes = new vis.DataSet([{"id": "Survey", "label": "Survey", "shape": "dot", "size": 10}, {"id": "Vocabulary", "label": "Vocabulary", "shape": "dot", "size": 10}, {"id": "HPRO", "label": "HPRO", "shape": "dot", "size": 10}, {"id": "PTSC", "label": "PTSC", "shape": "dot", "size": 10}, {"id": "RDR", "label": "RDR", "shape": "dot", "size": 10}, {"id": "EHR Ops", "label": "EHR Ops", "shape": "dot", "size": 10}, {"id": "PDR", "label": "PDR", "shape": "dot", "size": 10}, {"id": "CDR", "label": "CDR", "shape": "dot", "size": 10}, {"id": "Privacy", "label": "Privacy", "shape": "dot", "size": 10}, {"id": "Data Browser", "label": "Data Browser", "shape": "dot", "size": 10}, {"id": "Cohort Builder", "label": "Cohort Builder", "shape": "dot", "size": 10}, {"id": "Workbench", "label": "Workbench", "shape": "dot", "size": 10}]);
edges = new vis.DataSet([{"arrows": "to", "from": "Survey", "to": "Vocabulary", "weight": 1.0}, {"arrows": "to", "from": "Vocabulary", "to": "Survey", "weight": 1.0}, {"arrows": "to", "from": "Vocabulary", "to": "HPRO", "weight": 1.0}, {"arrows": "to", "from": "PTSC", "to": "Survey", "weight": 1.0}, {"arrows": "to", "from": "PTSC", "to": "Vocabulary", "weight": 1.0}, {"arrows": "to", "from": "HPRO", "to": "Vocabulary", "weight": 1.0}, {"arrows": "to", "from": "RDR", "to": "Survey", "weight": 1.0}, {"arrows": "to", "from": "RDR", "to": "Vocabulary", "weight": 1.0}, {"arrows": "to", "from": "RDR", "to": "PTSC", "weight": 1.0}, {"arrows": "to", "from": "RDR", "to": "HPRO", "weight": 1.0}, {"arrows": "to", "from": "EHR Ops", "to": "Vocabulary", "weight": 1.0}, {"arrows": "to", "from": "EHR Ops", "to": "HPRO", "weight": 1.0}, {"arrows": "to", "from": "EHR Ops", "to": "RDR", "weight": 1.0}, {"arrows": "to", "from": "EHR Ops", "to": "PDR", "weight": 1.0}, {"arrows": "to", "from": "PDR", "to": "Survey", "weight": 1.0}, {"arrows": "to", "from": "PDR", "to": "Vocabulary", "weight": 1.0}, {"arrows": "to", "from": "PDR", "to": "RDR", "weight": 1.0}, {"arrows": "to", "from": "PDR", "to": "EHR Ops", "weight": 1.0}, {"arrows": "to", "from": "CDR", "to": "Survey", "weight": 1.0}, {"arrows": "to", "from": "CDR", "to": "Vocabulary", "weight": 1.0}, {"arrows": "to", "from": "CDR", "to": "PTSC", "weight": 1.0}, {"arrows": "to", "from": "CDR", "to": "RDR", "weight": 1.0}, {"arrows": "to", "from": "CDR", "to": "EHR Ops", "weight": 1.0}, {"arrows": "to", "from": "CDR", "to": "Privacy", "weight": 1.0}, {"arrows": "to", "from": "Privacy", "to": "Survey", "weight": 1.0}, {"arrows": "to", "from": "Privacy", "to": "Vocabulary", "weight": 1.0}, {"arrows": "to", "from": "Privacy", "to": "HPRO", "weight": 1.0}, {"arrows": "to", "from": "Privacy", "to": "CDR", "weight": 1.0}, {"arrows": "to", "from": "Data Browser", "to": "Survey", "weight": 1.0}, {"arrows": "to", "from": "Data Browser", "to": "Vocabulary", "weight": 1.0}, {"arrows": "to", "from": "Data Browser", "to": "CDR", "weight": 1.0}, {"arrows": "to", "from": "Data Browser", "to": "Privacy", "weight": 1.0}, {"arrows": "to", "from": "Cohort Builder", "to": "Survey", "weight": 1.0}, {"arrows": "to", "from": "Cohort Builder", "to": "Vocabulary", "weight": 1.0}, {"arrows": "to", "from": "Cohort Builder", "to": "CDR", "weight": 1.0}, {"arrows": "to", "from": "Workbench", "to": "Survey", "weight": 1.0}, {"arrows": "to", "from": "Workbench", "to": "Vocabulary", "weight": 1.0}, {"arrows": "to", "from": "Workbench", "to": "CDR", "weight": 1.0}, {"arrows": "to", "from": "Workbench", "to": "Cohort Builder", "weight": 1.0}]);
// adding nodes and edges to the graph
data = {nodes: nodes, edges: edges};
var options = {
"configure": {
"enabled": false
},
"edges": {
"color": {
"inherit": true
},
"smooth": {
"enabled": false,
"type": "continuous"
}
},
"interaction": {
"dragNodes": true,
"hideEdgesOnDrag": false,
"hideNodesOnDrag": false
},
"physics": {
"enabled": true,
"stabilization": {
"enabled": true,
"fit": true,
"iterations": 1000,
"onlyDynamicEdges": false,
"updateInterval": 50
}
}
};
network = new vis.Network(container, data, options);
return network;
}
drawGraph();
</script>
</body>
</html>