-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview.html
46 lines (40 loc) · 1.31 KB
/
view.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
<!DOCTYPE html>
<h1>Component explorer</h1>
Read an arrow as "uses" - so an arrow from X to Y means that X uses Y
<!DOCTYPE html>
<html lang="en">
<head>
<title>Network</title>
<script type="text/javascript" src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"></script>
<style type="text/css">
#mynetwork {
width: 680px;
height: 600px;
border: 1px solid lightgray;
}
</style>
</head>
<body>
<div id="mynetwork"></div>
<script type="text/javascript">
function httpGet(theUrl) {
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", theUrl, false); // false for synchronous request
xmlHttp.send(null);
return xmlHttp.responseText;
}
graph = JSON.parse(httpGet("component_graph.json"));
var nodes = new vis.DataSet(graph.nodes);
// create an array with edges
var edges = new vis.DataSet(graph.links);
// create a network
var container = document.getElementById("mynetwork");
var data = {
nodes: nodes,
edges: edges,
};
var options = {layout: {improvedLayout: true}, edges: {arrows: "to"}};
var network = new vis.Network(container, data, options);
</script>
</body>
</html>