-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
225 lines (200 loc) · 6.86 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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
<title>Graph Sparrow</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.4/css/bulma.min.css">
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.min.js"></script>
<script src="jquery.arrows.js"></script>
<script src="springy.js"></script>
<script>
$(document).ready(function () {
// Add four nodes
const node1 = {
id: "node-1",
category: "green-node",
text: "i am node 1"
};
const node2 = {
id: "node-2",
category: "blue-node",
text: "i am node 2"
};
const node3 = {
id: "node-3",
category: "green-node",
text: "i am node 3"
};
const node4 = {
id: "node-4",
category: "blue-node",
text: "i am node 4"
};
const node5 = {
id: "node-5",
category: "red-node",
text: "i am node 5"
}
addNode(node1);
addNode(node2);
addNode(node3);
addNode(node4);
addNode(node5);
// Add edges between nodes
const edge1 = {
srcNodeId: "node-1",
dstNodeId: "node-2",
category: "blue-dashed-edge",
text: "edge from node-1 to node-2"
}
const edge2 = {
srcNodeId: "node-2",
dstNodeId: "node-3",
category: "purple-edge",
text: "edge from node-2 to node-3"
}
const edge3 = {
srcNodeId: "node-3",
dstNodeId: "node-4",
category: "blue-dashed-edge",
text: "edge from node-3 to node-4"
}
const edge4 = {
srcNodeId: "node-4",
dstNodeId: "node-1",
category: "purple-edge",
text: "edge from node-4 to node-1"
}
const edge5 = {
srcNodeId: "node-1",
dstNodeId: "node-3",
category: "orange-edge",
text: "edge from node-1 to node-3"
}
const edge6 = {
srcNodeId: "node-2",
dstNodeId: "node-4",
category: "orange-edge",
text: "edge from node-2 to node-4"
}
const edge7 = {
srcNodeId: "node-2",
dstNodeId: "node-5",
category: "blue-dashed-edge",
text: "edge from node-2 to node-5"
}
const edge8 = {
srcNodeId: "node-5",
dstNodeId: "node-3",
category: "orange-edge",
text: "edge from node-5 to node-3"
}
addEdge(edge1);
addEdge(edge2);
addEdge(edge3);
addEdge(edge4);
addEdge(edge5);
addEdge(edge6);
addEdge(edge7);
addEdge(edge8);
// Initial graph layout load
reloadGraphLayout();
});
</script>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div id="graph-menu">
<h3 class="title is-3" style="float: left; margin: 0.1em;">graph-sparrow</h3>
<div id="node-toggles">
<h3 class="title is-5" style="display: inline; margin: 0.5em;">Node Toggles</h5>
</div>
<div id="edge-toggles">
<h3 class="title is-5" style="display: inline; margin: 0.5em;">Edge Toggles</h5>
</div>
</div>
<div id="nodes-adder">
<button id="add-node" class="button is-link is-outlined" style="float:right;">
<span>Add</span>
<span class="icon is-small">
<i class="fas fa-plus"></i>
</span>
</button>
<h3 class="title is-5">Add a node</h3>
<div class="field">
<label class="label">Node id</label>
<div class="control">
<input id="node-id" class="input" type="text" placeholder="Node unique identifier">
</div>
</div>
<div class="field">
<label class="label">Node class</label>
<div class="control">
<div class="select">
<select id="node-class">
</select>
</div>
</div>
</div>
<div class="field">
<label class="label">Node text</label>
<div class="control">
<input id="node-text" class="input" type="text" placeholder="Text shown in node">
</div>
</div>
</div>
<div id="edges-adder">
<button id="add-edge" class="button is-link is-outlined" style="float:right;">
<span>Add</span>
<span class="icon is-small">
<i class="fas fa-plus"></i>
</span>
</button>
<h3 class="title is-5">Add an edge</h3>
<div class="field">
<label class="label">Source node id</label>
<div class="control">
<div class="select">
<select id="edge-src-node-id">
</select>
</div>
</div>
</div>
<div class="field">
<label class="label">Destination node id</label>
<div class="control">
<div class="select">
<select id="edge-dst-node-id">
</select>
</div>
</div>
</div>
<div class="field">
<label class="label">Edge class</label>
<div class="control">
<div class="select">
<select id="edge-class">
</select>
</div>
</div>
</div>
<div class="field">
<label class="label">Edge text</label>
<div class="control">
<input id="edge-text" class="input" type="text" placeholder="Text shown on edge">
</div>
</div>
</div>
<button id="reload-graph-layout" class="button is-warning is-large">Reshuffle</button>
<div id="hidden-nodes">
<h3 class="title is-5" style="float: right; margin: 0.3em;">Hidden Nodes</h3>
</div>
<div id="graph-viewer">
</div>
<div id="svg-arrows"></div>
<script src="addnodesedges.js"></script>
<script src="hideshownodes.js"></script>
<script src="edgenodetoggles.js"></script>
<script src="reloadgraphlayout.js"></script>
</body>