-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathindex.html
57 lines (46 loc) · 1.4 KB
/
index.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
<!doctype html>
<html>
<head>
<title>Network | Basic usage</title>
<script type="text/javascript" src="https://visjs.github.io/vis-network/dist/vis-network.min.js"></script>
<link href="https://visjs.github.io/vis-network/dist/vis-network.min.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#mynetwork {
width: 1600px;
height: 1200px;
border: 1px solid lightgray;
}
</style>
</head>
<body>
<div id="mynetwork"></div>
<script type="text/javascript" src="nodes.json"></script>
<script type="text/javascript">
//url = "http://192.168.0.178:8081/nodes.json"
//data = obj = await (await fetch(url)).json();
var parsed = JSON.parse(data);
// create a network
var container = document.getElementById("mynetwork");
// provide the data in the vis format
var data = {
nodes: parsed.nodes,
edges: parsed.links
};
var options = {
layout: {
randomSeed: 6,
hierarchical: {
direction: "LR",
sortMethod: "directed",
levelSeparation: 200,
nodeSpacing: 40,
}
},
interaction: {
hover: true
}
};
// initialize your network!
var network = new vis.Network(container, data, options);
</script>
</html>