forked from davidpiegza/Graph-Visualization
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex_example.html
More file actions
105 lines (102 loc) · 3.57 KB
/
index_example.html
File metadata and controls
105 lines (102 loc) · 3.57 KB
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
<!--
This is an example html file with some options added. The minimum html file for
the graph visualization is:
<!DOCTYPE html>
<html>
<head>
<title>Graph Visualization</title>
<script type="text/javascript" src="build/graph.min.js"></script>
</head>
<body onload="new Drawing.SimpleGraph({layout: '3d', showStats: true, showInfo: true})">
</bod>
</html>
-->
<!DOCTYPE html>
<html>
<head>
<title>Graph Visualization</title>
<script type="text/javascript" src="Graph.js"></script>
<script type="text/javascript" src="webgl-frameworks/three.min.js"></script>
<script type="text/javascript" src="utils/Stats.js"></script>
<script type="text/javascript" src="utils/TrackballControls.js"></script>
<script type="text/javascript" src="utils/Label.js"></script>
<script type="text/javascript" src="utils/ObjectSelection.js"></script>
<script type="text/javascript" src="layouts/force-directed-layout.js"></script>
<script type="text/javascript" src="drawings/simple_graph.js"></script>
<script type="text/javascript" src="drawings/sphere_graph.js"></script>
<script type="text/javascript">
var drawing;
function createDrawing() {
var index = parseInt(location.search.split("?")[1]);
if(isNaN(index)) {
index = 1;
}
/* Change these values to draw more nodes (numNodes) */
switch(index) {
case 0:
drawing = new Drawing.SimpleGraph({layout: '2d', selection: true, numNodes: 50, showStats: true, showInfo: true});
break;
case 1:
drawing = new Drawing.SimpleGraph({layout: '3d', selection: true, numNodes: 50, graphLayout:{attraction: 5, repulsion: 0.5}, showStats: true, showInfo: true});
break;
case 2:
drawing = new Drawing.SphereGraph({numNodes: 50, showStats: true, showInfo: true});
break;
default:
drawing = new Drawing.SimpleGraph({layout: '3d', selection: true, numNodes: 50, showStats: true, showInfo: true});
}
document.getElementById("drawing_select").selectedIndex = index;
}
</script>
<style type="text/css">
body {
margin: 0;
padding: 0;
background-color: #f0f0f0;
font: 11px courier;
overflow: hidden;
}
#graph-info {
position: absolute;
top: 0px;
left: 40%;
margin: 10px;
background-color: #ffffe0;
color: #333;
padding: 5px 10px;
}
#options {
position: absolute;
top: 0;
right: 0;
z-index: 10;
}
</style>
</head>
<body onload="createDrawing()">
<div id="options">
<form>
<p>
<label>Drawing</label><br>
<select id="drawing_select" onchange="window.location.href = '?' + this.selectedIndex;">
<option>2D-Force-Directed</option>
<option selected="selected">3D-Force-Directed</option>
<option>Sphere Graph</option>
</select>
</p>
<p>
<input type="checkbox" id="show_labels" onclick="drawing.show_labels = this.checked;">
<label for="show_labels">Show labels</label>
</p>
<p>
<input type="button" value="Stop layout" onclick="drawing.stop_calculating();">
</p>
</form>
</div>
<div style="position: absolute; bottom: 0;">
Rotate: Left Mouse Button and Move<br />
Zoom: Press Key S + Left Mouse Button and Move<br />
Drag: Press Key D + Left Mouse Button and Move
</div>
</body>
</html>