mongo3 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +6 -2
- data/Rakefile +1 -0
- data/data/populate +13 -11
- data/lib/controllers/databases.rb +3 -3
- data/lib/controllers/explore.rb +7 -5
- data/lib/helpers/main_helper.rb +24 -0
- data/lib/mongo3/connection.rb +105 -59
- data/lib/mongo3/node.rb +35 -6
- data/lib/mongo3.rb +1 -1
- data/lib/public/javascripts/{Jit/jit.js → jit.js} +0 -0
- data/lib/views/databases/_results.erb +29 -12
- data/lib/views/explore/explore.erb +52 -31
- data/lib/views/layout.erb +2 -6
- data/spec/mongo3/connection_spec.rb +40 -6
- metadata +13 -45
- data/lib/public/javascripts/Jit/Examples/Hypertree/example1.html +0 -57
- data/lib/public/javascripts/Jit/Examples/Hypertree/example1.js +0 -427
- data/lib/public/javascripts/Jit/Examples/Hypertree/example2.html +0 -58
- data/lib/public/javascripts/Jit/Examples/Hypertree/example2.js +0 -310
- data/lib/public/javascripts/Jit/Examples/Hypertree/example3.html +0 -199
- data/lib/public/javascripts/Jit/Examples/Hypertree/example3.js +0 -615
- data/lib/public/javascripts/Jit/Examples/Other/example1.html +0 -58
- data/lib/public/javascripts/Jit/Examples/Other/example1.js +0 -566
- data/lib/public/javascripts/Jit/Examples/Other/example2.html +0 -58
- data/lib/public/javascripts/Jit/Examples/Other/example2.js +0 -304
- data/lib/public/javascripts/Jit/Examples/Other/example3.html +0 -58
- data/lib/public/javascripts/Jit/Examples/Other/example3.js +0 -304
- data/lib/public/javascripts/Jit/Examples/RGraph/example1.html +0 -57
- data/lib/public/javascripts/Jit/Examples/RGraph/example1.js +0 -475
- data/lib/public/javascripts/Jit/Examples/RGraph/example2.html +0 -58
- data/lib/public/javascripts/Jit/Examples/RGraph/example2.js +0 -356
- data/lib/public/javascripts/Jit/Examples/RGraph/example3.html +0 -199
- data/lib/public/javascripts/Jit/Examples/RGraph/example3.js +0 -622
- data/lib/public/javascripts/Jit/Examples/Spacetree/example1.html +0 -91
- data/lib/public/javascripts/Jit/Examples/Spacetree/example1.js +0 -890
- data/lib/public/javascripts/Jit/Examples/Spacetree/example2.html +0 -90
- data/lib/public/javascripts/Jit/Examples/Spacetree/example2.js +0 -213
- data/lib/public/javascripts/Jit/Examples/Spacetree/example3.html +0 -75
- data/lib/public/javascripts/Jit/Examples/Spacetree/example3.js +0 -863
- data/lib/public/javascripts/Jit/Examples/Treemap/example1.html +0 -56
- data/lib/public/javascripts/Jit/Examples/Treemap/example1.js +0 -95
- data/lib/public/javascripts/Jit/Examples/Treemap/example2.html +0 -61
- data/lib/public/javascripts/Jit/Examples/Treemap/example2.js +0 -750
- data/lib/public/javascripts/Jit/Examples/Treemap/example3.html +0 -62
- data/lib/public/javascripts/Jit/Examples/Treemap/example3.js +0 -775
- data/lib/public/javascripts/Jit/Examples/css/Hypertree.css +0 -0
- data/lib/public/javascripts/Jit/Examples/css/Other.css +0 -8
- data/lib/public/javascripts/Jit/Examples/css/RGraph.css +0 -0
- data/lib/public/javascripts/Jit/Examples/css/Spacetree.css +0 -0
- data/lib/public/javascripts/Jit/Examples/css/Treemap.css +0 -78
- data/lib/public/javascripts/Jit/Examples/css/base.css +0 -106
- data/lib/public/javascripts/Jit/Examples/css/col1.png +0 -0
- data/lib/public/javascripts/Jit/Examples/css/col2.png +0 -0
- data/lib/public/javascripts/Jit/Examples/css/gradient.png +0 -0
- data/lib/public/javascripts/Jit/Extras/excanvas.js +0 -35
- data/lib/public/javascripts/Jit/jit-yc.js +0 -1
- data/lib/public/javascripts/Jit-1.1.3.zip +0 -0
@@ -1,615 +0,0 @@
|
|
1
|
-
var Log = {
|
2
|
-
elem: false,
|
3
|
-
write: function(text){
|
4
|
-
if (!this.elem)
|
5
|
-
this.elem = document.getElementById('log');
|
6
|
-
this.elem.innerHTML = text;
|
7
|
-
this.elem.style.left = (500 - this.elem.offsetWidth / 2) + 'px';
|
8
|
-
}
|
9
|
-
};
|
10
|
-
|
11
|
-
function addEvent(obj, type, fn) {
|
12
|
-
if (obj.addEventListener) obj.addEventListener(type, fn, false);
|
13
|
-
else obj.attachEvent('on' + type, fn);
|
14
|
-
};
|
15
|
-
|
16
|
-
|
17
|
-
function init(){
|
18
|
-
//init data
|
19
|
-
var json = {
|
20
|
-
"id": "190_0",
|
21
|
-
"name": "Pearl Jam",
|
22
|
-
"children": [{
|
23
|
-
"id": "306208_1",
|
24
|
-
"name": "Pearl Jam & Cypress Hill",
|
25
|
-
"data": {
|
26
|
-
"band": "Pearl Jam",
|
27
|
-
"relation": "collaboration"
|
28
|
-
},
|
29
|
-
"children": [{
|
30
|
-
"id": "84_2",
|
31
|
-
"name": "Cypress Hill",
|
32
|
-
"data": {
|
33
|
-
"band": "Pearl Jam & Cypress Hill",
|
34
|
-
"relation": "collaboration"
|
35
|
-
},
|
36
|
-
"children": []
|
37
|
-
}]
|
38
|
-
}, {
|
39
|
-
"id": "107877_3",
|
40
|
-
"name": "Neil Young & Pearl Jam",
|
41
|
-
"data": {
|
42
|
-
"band": "Pearl Jam",
|
43
|
-
"relation": "collaboration"
|
44
|
-
},
|
45
|
-
"children": [{
|
46
|
-
"id": "964_4",
|
47
|
-
"name": "Neil Young",
|
48
|
-
"data": {
|
49
|
-
"band": "Neil Young & Pearl Jam",
|
50
|
-
"relation": "collaboration"
|
51
|
-
},
|
52
|
-
"children": []
|
53
|
-
}]
|
54
|
-
}, {
|
55
|
-
"id": "236797_5",
|
56
|
-
"name": "Jeff Ament",
|
57
|
-
"data": {
|
58
|
-
"band": "Pearl Jam",
|
59
|
-
"relation": "member of band"
|
60
|
-
},
|
61
|
-
"children": [{
|
62
|
-
"id": "1756_6",
|
63
|
-
"name": "Temple of the Dog",
|
64
|
-
"data": {
|
65
|
-
"band": "Jeff Ament",
|
66
|
-
"relation": "member of band"
|
67
|
-
},
|
68
|
-
"children": []
|
69
|
-
}, {
|
70
|
-
"id": "14581_7",
|
71
|
-
"name": "Mother Love Bone",
|
72
|
-
"data": {
|
73
|
-
"band": "Jeff Ament",
|
74
|
-
"relation": "member of band"
|
75
|
-
},
|
76
|
-
"children": []
|
77
|
-
}, {
|
78
|
-
"id": "50188_8",
|
79
|
-
"name": "Green River",
|
80
|
-
"data": {
|
81
|
-
"band": "Jeff Ament",
|
82
|
-
"relation": "member of band"
|
83
|
-
},
|
84
|
-
"children": []
|
85
|
-
}, {
|
86
|
-
"id": "65452_9",
|
87
|
-
"name": "M.A.C.C.",
|
88
|
-
"data": {
|
89
|
-
"band": "Jeff Ament",
|
90
|
-
"relation": "collaboration"
|
91
|
-
},
|
92
|
-
"children": []
|
93
|
-
}, {
|
94
|
-
"id": "115632_10",
|
95
|
-
"name": "Three Fish",
|
96
|
-
"data": {
|
97
|
-
"band": "Jeff Ament",
|
98
|
-
"relation": "member of band"
|
99
|
-
},
|
100
|
-
"children": []
|
101
|
-
}, {
|
102
|
-
"id": "346850_11",
|
103
|
-
"name": "Gossman Project",
|
104
|
-
"data": {
|
105
|
-
"band": "Jeff Ament",
|
106
|
-
"relation": "member of band"
|
107
|
-
},
|
108
|
-
"children": []
|
109
|
-
}]
|
110
|
-
}, {
|
111
|
-
"id": "41529_12",
|
112
|
-
"name": "Stone Gossard",
|
113
|
-
"data": {
|
114
|
-
"band": "Pearl Jam",
|
115
|
-
"relation": "member of band"
|
116
|
-
},
|
117
|
-
"children": [{
|
118
|
-
"id": "1756_13",
|
119
|
-
"name": "Temple of the Dog",
|
120
|
-
"data": {
|
121
|
-
"band": "Stone Gossard",
|
122
|
-
"relation": "member of band"
|
123
|
-
},
|
124
|
-
"children": []
|
125
|
-
}, {
|
126
|
-
"id": "14581_14",
|
127
|
-
"name": "Mother Love Bone",
|
128
|
-
"data": {
|
129
|
-
"band": "Stone Gossard",
|
130
|
-
"relation": "member of band"
|
131
|
-
},
|
132
|
-
"children": []
|
133
|
-
}, {
|
134
|
-
"id": "24119_15",
|
135
|
-
"name": "Brad",
|
136
|
-
"data": {
|
137
|
-
"band": "Stone Gossard",
|
138
|
-
"relation": "member of band"
|
139
|
-
},
|
140
|
-
"children": []
|
141
|
-
}, {
|
142
|
-
"id": "50188_16",
|
143
|
-
"name": "Green River",
|
144
|
-
"data": {
|
145
|
-
"band": "Stone Gossard",
|
146
|
-
"relation": "member of band"
|
147
|
-
},
|
148
|
-
"children": []
|
149
|
-
}, {
|
150
|
-
"id": "346850_17",
|
151
|
-
"name": "Gossman Project",
|
152
|
-
"data": {
|
153
|
-
"band": "Stone Gossard",
|
154
|
-
"relation": "member of band"
|
155
|
-
},
|
156
|
-
"children": []
|
157
|
-
}]
|
158
|
-
}, {
|
159
|
-
"id": "131161_18",
|
160
|
-
"name": "Eddie Vedder",
|
161
|
-
"data": {
|
162
|
-
"band": "Pearl Jam",
|
163
|
-
"relation": "member of band"
|
164
|
-
},
|
165
|
-
"children": [{
|
166
|
-
"id": "1756_19",
|
167
|
-
"name": "Temple of the Dog",
|
168
|
-
"data": {
|
169
|
-
"band": "Eddie Vedder",
|
170
|
-
"relation": "member of band"
|
171
|
-
},
|
172
|
-
"children": []
|
173
|
-
}, {
|
174
|
-
"id": "72007_20",
|
175
|
-
"name": "Eddie Vedder & Zeke",
|
176
|
-
"data": {
|
177
|
-
"band": "Eddie Vedder",
|
178
|
-
"relation": "collaboration"
|
179
|
-
},
|
180
|
-
"children": []
|
181
|
-
}, {
|
182
|
-
"id": "236657_21",
|
183
|
-
"name": "Bad Radio",
|
184
|
-
"data": {
|
185
|
-
"band": "Eddie Vedder",
|
186
|
-
"relation": "member of band"
|
187
|
-
},
|
188
|
-
"children": []
|
189
|
-
}, {
|
190
|
-
"id": "432176_22",
|
191
|
-
"name": "Beck & Eddie Vedder",
|
192
|
-
"data": {
|
193
|
-
"band": "Eddie Vedder",
|
194
|
-
"relation": "collaboration"
|
195
|
-
},
|
196
|
-
"children": []
|
197
|
-
}]
|
198
|
-
}, {
|
199
|
-
"id": "236583_23",
|
200
|
-
"name": "Mike McCready",
|
201
|
-
"data": {
|
202
|
-
"band": "Pearl Jam",
|
203
|
-
"relation": "member of band"
|
204
|
-
},
|
205
|
-
"children": [{
|
206
|
-
"id": "1744_24",
|
207
|
-
"name": "Mad Season",
|
208
|
-
"data": {
|
209
|
-
"band": "Mike McCready",
|
210
|
-
"relation": "member of band"
|
211
|
-
},
|
212
|
-
"children": []
|
213
|
-
}, {
|
214
|
-
"id": "1756_25",
|
215
|
-
"name": "Temple of the Dog",
|
216
|
-
"data": {
|
217
|
-
"band": "Mike McCready",
|
218
|
-
"relation": "member of band"
|
219
|
-
},
|
220
|
-
"children": []
|
221
|
-
}, {
|
222
|
-
"id": "43661_26",
|
223
|
-
"name": "$10,000 Gold Chain",
|
224
|
-
"data": {
|
225
|
-
"band": "Mike McCready",
|
226
|
-
"relation": "collaboration"
|
227
|
-
},
|
228
|
-
"children": []
|
229
|
-
}, {
|
230
|
-
"id": "65452_27",
|
231
|
-
"name": "M.A.C.C.",
|
232
|
-
"data": {
|
233
|
-
"band": "Mike McCready",
|
234
|
-
"relation": "collaboration"
|
235
|
-
},
|
236
|
-
"children": []
|
237
|
-
}, {
|
238
|
-
"id": "153766_28",
|
239
|
-
"name": "The Rockfords",
|
240
|
-
"data": {
|
241
|
-
"band": "Mike McCready",
|
242
|
-
"relation": "member of band"
|
243
|
-
},
|
244
|
-
"children": []
|
245
|
-
}, {
|
246
|
-
"id": "346850_29",
|
247
|
-
"name": "Gossman Project",
|
248
|
-
"data": {
|
249
|
-
"band": "Mike McCready",
|
250
|
-
"relation": "member of band"
|
251
|
-
},
|
252
|
-
"children": []
|
253
|
-
}]
|
254
|
-
}, {
|
255
|
-
"id": "236585_30",
|
256
|
-
"name": "Matt Cameron",
|
257
|
-
"data": {
|
258
|
-
"band": "Pearl Jam",
|
259
|
-
"relation": "member of band"
|
260
|
-
},
|
261
|
-
"children": [{
|
262
|
-
"id": "1111_31",
|
263
|
-
"name": "Soundgarden",
|
264
|
-
"data": {
|
265
|
-
"band": "Matt Cameron",
|
266
|
-
"relation": "member of band"
|
267
|
-
},
|
268
|
-
"children": []
|
269
|
-
}, {
|
270
|
-
"id": "1756_32",
|
271
|
-
"name": "Temple of the Dog",
|
272
|
-
"data": {
|
273
|
-
"band": "Matt Cameron",
|
274
|
-
"relation": "member of band"
|
275
|
-
},
|
276
|
-
"children": []
|
277
|
-
}, {
|
278
|
-
"id": "9570_33",
|
279
|
-
"name": "Eleven",
|
280
|
-
"data": {
|
281
|
-
"band": "Matt Cameron",
|
282
|
-
"relation": "supporting musician"
|
283
|
-
},
|
284
|
-
"children": []
|
285
|
-
}, {
|
286
|
-
"id": "11783_34",
|
287
|
-
"name": "Queens of the Stone Age",
|
288
|
-
"data": {
|
289
|
-
"band": "Matt Cameron",
|
290
|
-
"relation": "member of band"
|
291
|
-
},
|
292
|
-
"children": []
|
293
|
-
}, {
|
294
|
-
"id": "61972_35",
|
295
|
-
"name": "Wellwater Conspiracy",
|
296
|
-
"data": {
|
297
|
-
"band": "Matt Cameron",
|
298
|
-
"relation": "member of band"
|
299
|
-
},
|
300
|
-
"children": []
|
301
|
-
}, {
|
302
|
-
"id": "65452_36",
|
303
|
-
"name": "M.A.C.C.",
|
304
|
-
"data": {
|
305
|
-
"band": "Matt Cameron",
|
306
|
-
"relation": "collaboration"
|
307
|
-
},
|
308
|
-
"children": []
|
309
|
-
}, {
|
310
|
-
"id": "353097_37",
|
311
|
-
"name": "Tone Dogs",
|
312
|
-
"data": {
|
313
|
-
"band": "Matt Cameron",
|
314
|
-
"relation": "member of band"
|
315
|
-
},
|
316
|
-
"children": []
|
317
|
-
}]
|
318
|
-
}, {
|
319
|
-
"id": "236594_38",
|
320
|
-
"name": "Dave Krusen",
|
321
|
-
"data": {
|
322
|
-
"band": "Pearl Jam",
|
323
|
-
"relation": "member of band"
|
324
|
-
},
|
325
|
-
"children": [{
|
326
|
-
"id": "2092_39",
|
327
|
-
"name": "Candlebox",
|
328
|
-
"data": {
|
329
|
-
"band": "Dave Krusen",
|
330
|
-
"relation": "member of band"
|
331
|
-
},
|
332
|
-
"children": []
|
333
|
-
}]
|
334
|
-
}, {
|
335
|
-
"id": "236022_40",
|
336
|
-
"name": "Matt Chamberlain",
|
337
|
-
"data": {
|
338
|
-
"band": "Pearl Jam",
|
339
|
-
"relation": "member of band"
|
340
|
-
},
|
341
|
-
"children": [{
|
342
|
-
"id": "54761_41",
|
343
|
-
"name": "Critters Buggin",
|
344
|
-
"data": {
|
345
|
-
"band": "Matt Chamberlain",
|
346
|
-
"relation": "member of band"
|
347
|
-
},
|
348
|
-
"children": []
|
349
|
-
}, {
|
350
|
-
"id": "92043_42",
|
351
|
-
"name": "Edie Brickell and New Bohemians",
|
352
|
-
"data": {
|
353
|
-
"band": "Matt Chamberlain",
|
354
|
-
"relation": "member of band"
|
355
|
-
},
|
356
|
-
"children": []
|
357
|
-
}]
|
358
|
-
}, {
|
359
|
-
"id": "236611_43",
|
360
|
-
"name": "Dave Abbruzzese",
|
361
|
-
"data": {
|
362
|
-
"band": "Pearl Jam",
|
363
|
-
"relation": "member of band"
|
364
|
-
},
|
365
|
-
"children": [{
|
366
|
-
"id": "276933_44",
|
367
|
-
"name": "Green Romance Orchestra",
|
368
|
-
"data": {
|
369
|
-
"band": "Dave Abbruzzese",
|
370
|
-
"relation": "member of band"
|
371
|
-
},
|
372
|
-
"children": []
|
373
|
-
}]
|
374
|
-
}, {
|
375
|
-
"id": "236612_45",
|
376
|
-
"name": "Jack Irons",
|
377
|
-
"data": {
|
378
|
-
"band": "Pearl Jam",
|
379
|
-
"relation": "member of band"
|
380
|
-
},
|
381
|
-
"children": [{
|
382
|
-
"id": "4619_46",
|
383
|
-
"name": "Redd Kross",
|
384
|
-
"data": {
|
385
|
-
"band": "Jack Irons",
|
386
|
-
"relation": "member of band"
|
387
|
-
},
|
388
|
-
"children": []
|
389
|
-
}, {
|
390
|
-
"id": "9570_47",
|
391
|
-
"name": "Eleven",
|
392
|
-
"data": {
|
393
|
-
"band": "Jack Irons",
|
394
|
-
"relation": "member of band"
|
395
|
-
},
|
396
|
-
"children": []
|
397
|
-
}, {
|
398
|
-
"id": "12389_48",
|
399
|
-
"name": "Red Hot Chili Peppers",
|
400
|
-
"data": {
|
401
|
-
"band": "Jack Irons",
|
402
|
-
"relation": "member of band"
|
403
|
-
},
|
404
|
-
"children": []
|
405
|
-
}, {
|
406
|
-
"id": "114288_49",
|
407
|
-
"name": "Anthym",
|
408
|
-
"data": {
|
409
|
-
"band": "Jack Irons",
|
410
|
-
"relation": "member of band"
|
411
|
-
},
|
412
|
-
"children": []
|
413
|
-
}, {
|
414
|
-
"id": "240013_50",
|
415
|
-
"name": "What Is This?",
|
416
|
-
"data": {
|
417
|
-
"band": "Jack Irons",
|
418
|
-
"relation": "member of band"
|
419
|
-
},
|
420
|
-
"children": []
|
421
|
-
}]
|
422
|
-
}],
|
423
|
-
"data": []
|
424
|
-
};
|
425
|
-
|
426
|
-
var graph = '[{id:"190_0", adjacencies:["node0"]}, {id:"node0", name:"node0 name", data:{$dim:8.660354683365695, "some other key":"some other value"}, adjacencies:["node1", "node2", "node3", "node4", "node5"]}, {id:"node1", name:"node1 name", data:{$dim:21.118129724156983, "some other key":"some other value"}, adjacencies:["node0", "node2", "node3", "node4", "node5"]}, {id:"node2", name:"node2 name", data:{$dim:6.688951018413683, "some other key":"some other value"}, adjacencies:["node0", "node1", "node3", "node4", "node5"]}, {id:"node3", name:"node3 name", data:{$dim:19.78771599710248, "some other key":"some other value"}, adjacencies:["node0", "node1", "node2", "node4", "node5"]}, {id:"node4", name:"node4 name", data:{$dim:3.025781742947326, "some other key":"some other value"}, adjacencies:["node0", "node1", "node2", "node3", "node5"]}, {id:"node5", name:"node5 name", data:{$dim:9.654383829711456, "some other key":"some other value"}, adjacencies:["node0", "node1", "node2", "node3", "node4"]}, {id:"4619_46", adjacencies:["190_0"]}, {id:"236585_30", adjacencies:["190_0"]}, {id:"131161_18", adjacencies:["190_0"]}, {id:"41529_12", adjacencies:["190_0"]}]';
|
427
|
-
//end
|
428
|
-
|
429
|
-
var infovis = document.getElementById('infovis');
|
430
|
-
var w = infovis.offsetWidth - 50, h = infovis.offsetHeight - 50;
|
431
|
-
|
432
|
-
//init canvas
|
433
|
-
//Create a new canvas instance.
|
434
|
-
var canvas = new Canvas('mycanvas', {
|
435
|
-
'injectInto': 'infovis',
|
436
|
-
'width': w,
|
437
|
-
'height': h
|
438
|
-
});
|
439
|
-
//end
|
440
|
-
var style = document.getElementById('mycanvas').style;
|
441
|
-
style.marginLeft = style.marginTop = "25px";
|
442
|
-
|
443
|
-
//init Hypertree
|
444
|
-
var ht = new Hypertree(canvas, {
|
445
|
-
//Change node and Edge styles and colors.
|
446
|
-
Node: {
|
447
|
-
dim: 9,
|
448
|
-
color: "#f00"
|
449
|
-
},
|
450
|
-
|
451
|
-
Edge: {
|
452
|
-
lineWidth: 2,
|
453
|
-
color: "#088"
|
454
|
-
},
|
455
|
-
|
456
|
-
onBeforeCompute: function(node){
|
457
|
-
Log.write("centering");
|
458
|
-
},
|
459
|
-
//Add the node's name to its corresponding label.
|
460
|
-
//This method is only called on label creation.
|
461
|
-
onCreateLabel: function(domElement, node){
|
462
|
-
domElement.innerHTML = node.name;
|
463
|
-
},
|
464
|
-
|
465
|
-
//Ths method is called when moving/placing a label.
|
466
|
-
//Add label styles based on their position.
|
467
|
-
onPlaceLabel: function(domElement, node){
|
468
|
-
var style = domElement.style;
|
469
|
-
style.display = '';
|
470
|
-
if (node._depth <= 1) {
|
471
|
-
style.fontSize = "0.8em";
|
472
|
-
style.color = "#ddd";
|
473
|
-
|
474
|
-
} else if(node._depth == 2){
|
475
|
-
style.fontSize = "0.7em";
|
476
|
-
style.color = "#555";
|
477
|
-
|
478
|
-
} else {
|
479
|
-
style.display = 'none';
|
480
|
-
}
|
481
|
-
|
482
|
-
var left = parseInt(style.left);
|
483
|
-
var w = domElement.offsetWidth;
|
484
|
-
style.left = (left - w / 2) + 'px';
|
485
|
-
},
|
486
|
-
|
487
|
-
onAfterCompute: function(){
|
488
|
-
Log.write("done");
|
489
|
-
}
|
490
|
-
});
|
491
|
-
|
492
|
-
//load JSON data.
|
493
|
-
ht.loadJSON(json);
|
494
|
-
|
495
|
-
//Add some edges to transform the
|
496
|
-
//tree into a graph (just for fun).
|
497
|
-
ht.graph.addAdjacence({
|
498
|
-
'id': '236585_30'
|
499
|
-
}, {
|
500
|
-
'id': '236583_23'
|
501
|
-
}, null);
|
502
|
-
ht.graph.addAdjacence({
|
503
|
-
'id': '236585_30'
|
504
|
-
}, {
|
505
|
-
'id': '4619_46'
|
506
|
-
}, null);
|
507
|
-
|
508
|
-
//Compute positions and plot.
|
509
|
-
ht.refresh();
|
510
|
-
//end
|
511
|
-
|
512
|
-
//Global Options
|
513
|
-
//Define a function that returns the selected duration
|
514
|
-
function getDuration() {
|
515
|
-
var sduration = document.getElementById('select-duration');
|
516
|
-
var sdindex = sduration.selectedIndex;
|
517
|
-
return parseInt(sduration.options[sdindex].text);
|
518
|
-
};
|
519
|
-
//Define a function that returns the selected fps
|
520
|
-
function getFPS() {
|
521
|
-
var fpstype = document.getElementById('select-fps');
|
522
|
-
var fpsindex = fpstype.selectedIndex;
|
523
|
-
return parseInt(fpstype.options[fpsindex].text);
|
524
|
-
};
|
525
|
-
//Define a function that returns whether you have to
|
526
|
-
//hide labels during the animation or not.
|
527
|
-
function hideLabels() {
|
528
|
-
return document.getElementById('hide-labels').checked;
|
529
|
-
};
|
530
|
-
|
531
|
-
//init handlers
|
532
|
-
//Add event handlers to the right column controls.
|
533
|
-
|
534
|
-
//Remove Nodes
|
535
|
-
var button = document.getElementById('remove-nodes');
|
536
|
-
button.onclick = function() {
|
537
|
-
//get animation type.
|
538
|
-
var stype = document.getElementById('select-type-remove-nodes');
|
539
|
-
var sindex = stype.selectedIndex;
|
540
|
-
var type = stype.options[sindex].text;
|
541
|
-
//get node ids to be removed.
|
542
|
-
var subnodes = Graph.Util.getSubnodes(ht.graph.getNode('236797_5'), 0);
|
543
|
-
var map = [];
|
544
|
-
for (var i = 0; i < subnodes.length; i++) {
|
545
|
-
map.push(subnodes[i].id);
|
546
|
-
}
|
547
|
-
//perform node-removing animation.
|
548
|
-
ht.op.removeNode(map.reverse(), {
|
549
|
-
type: type,
|
550
|
-
duration: getDuration(),
|
551
|
-
fps: getFPS(),
|
552
|
-
hideLabels:hideLabels()
|
553
|
-
});
|
554
|
-
};
|
555
|
-
|
556
|
-
//Remove edges
|
557
|
-
button = document.getElementById('remove-edges');
|
558
|
-
button.onclick = function() {
|
559
|
-
//get animation type.
|
560
|
-
var stype = document.getElementById('select-type-remove-edges');
|
561
|
-
var sindex = stype.selectedIndex;
|
562
|
-
var type = stype.options[sindex].text;
|
563
|
-
//perform edge removing animation.
|
564
|
-
ht.op.removeEdge([['236585_30', "190_0"], ['236585_30', '4619_46']], {
|
565
|
-
type: type,
|
566
|
-
duration: getDuration(),
|
567
|
-
fps: getFPS(),
|
568
|
-
hideLabels: hideLabels()
|
569
|
-
});
|
570
|
-
};
|
571
|
-
|
572
|
-
//Add a Graph (Sum)
|
573
|
-
button = document.getElementById('sum');
|
574
|
-
button.onclick = function(){
|
575
|
-
//get graph to add.
|
576
|
-
var trueGraph = eval('(' + graph + ')');
|
577
|
-
//get animation type.
|
578
|
-
var stype = document.getElementById('select-type-sum');
|
579
|
-
var sindex = stype.selectedIndex;
|
580
|
-
var type = stype.options[sindex].text;
|
581
|
-
//perform sum animation.
|
582
|
-
ht.op.sum(trueGraph, {
|
583
|
-
type: type,
|
584
|
-
fps: getFPS(),
|
585
|
-
duration: getDuration(),
|
586
|
-
hideLabels: hideLabels(),
|
587
|
-
onComplete: function(){
|
588
|
-
Log.write("sum complete!");
|
589
|
-
}
|
590
|
-
});
|
591
|
-
};
|
592
|
-
|
593
|
-
//Morph
|
594
|
-
button = document.getElementById('morph');
|
595
|
-
button.onclick = function(){
|
596
|
-
//get graph to morph to.
|
597
|
-
var trueGraph = eval('(' + graph + ')');
|
598
|
-
//get animation type.
|
599
|
-
var stype = document.getElementById('select-type-morph');
|
600
|
-
var sindex = stype.selectedIndex;
|
601
|
-
var type = stype.options[sindex].text;
|
602
|
-
//perform morphing animation.
|
603
|
-
ht.op.morph(trueGraph, {
|
604
|
-
type: type,
|
605
|
-
fps: getFPS(),
|
606
|
-
duration: getDuration(),
|
607
|
-
hideLabels: hideLabels(),
|
608
|
-
onComplete: function(){
|
609
|
-
Log.write("morph complete!");
|
610
|
-
}
|
611
|
-
});
|
612
|
-
};
|
613
|
-
//end
|
614
|
-
}
|
615
|
-
|
@@ -1,58 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
3
|
-
<head>
|
4
|
-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
5
|
-
<title>Other - Implementing Node Types</title>
|
6
|
-
|
7
|
-
<!-- CSS Files -->
|
8
|
-
<link type="text/css" href="../css/base.css" rel="stylesheet" />
|
9
|
-
<link type="text/css" href="../css/Other.css" rel="stylesheet" />
|
10
|
-
|
11
|
-
<!--[if IE]><script language="javascript" type="text/javascript" src="../../Extras/excanvas.js"></script><![endif]-->
|
12
|
-
|
13
|
-
<!-- JIT Library File -->
|
14
|
-
<script language="javascript" type="text/javascript" src="../../jit.js"></script>
|
15
|
-
|
16
|
-
<!-- Example File -->
|
17
|
-
<script language="javascript" type="text/javascript" src="example1.js"></script>
|
18
|
-
</head>
|
19
|
-
|
20
|
-
<body onload="init();">
|
21
|
-
<div id="container">
|
22
|
-
|
23
|
-
<div id="left-container">
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
<div class="text">
|
28
|
-
<h4>
|
29
|
-
Implementing Node Types
|
30
|
-
</h4>
|
31
|
-
|
32
|
-
In this example some custom node types are created for rendering pie charts with the RGraph.<br /><br />
|
33
|
-
Multiple instances of the RGraph are created using these node types. (top)<br /><br />
|
34
|
-
The SpaceTree is loaded with some custom data that individually changes nodes dimensions, making a bar chart (bottom).
|
35
|
-
|
36
|
-
|
37
|
-
</div>
|
38
|
-
|
39
|
-
<div id="id-list"></div>
|
40
|
-
|
41
|
-
|
42
|
-
<div style="text-align:center;"><a href="example1.js">See the Example Code</a></div>
|
43
|
-
</div>
|
44
|
-
|
45
|
-
<div id="center-container">
|
46
|
-
<div id="infovis"></div>
|
47
|
-
</div>
|
48
|
-
|
49
|
-
<div id="right-container">
|
50
|
-
|
51
|
-
<div id="inner-details"></div>
|
52
|
-
|
53
|
-
</div>
|
54
|
-
|
55
|
-
<div id="log"></div>
|
56
|
-
</div>
|
57
|
-
</body>
|
58
|
-
</html>
|