mongo3 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/README.rdoc +6 -2
  2. data/Rakefile +1 -0
  3. data/data/populate +13 -11
  4. data/lib/controllers/databases.rb +3 -3
  5. data/lib/controllers/explore.rb +7 -5
  6. data/lib/helpers/main_helper.rb +24 -0
  7. data/lib/mongo3/connection.rb +105 -59
  8. data/lib/mongo3/node.rb +35 -6
  9. data/lib/mongo3.rb +1 -1
  10. data/lib/public/javascripts/{Jit/jit.js → jit.js} +0 -0
  11. data/lib/views/databases/_results.erb +29 -12
  12. data/lib/views/explore/explore.erb +52 -31
  13. data/lib/views/layout.erb +2 -6
  14. data/spec/mongo3/connection_spec.rb +40 -6
  15. metadata +13 -45
  16. data/lib/public/javascripts/Jit/Examples/Hypertree/example1.html +0 -57
  17. data/lib/public/javascripts/Jit/Examples/Hypertree/example1.js +0 -427
  18. data/lib/public/javascripts/Jit/Examples/Hypertree/example2.html +0 -58
  19. data/lib/public/javascripts/Jit/Examples/Hypertree/example2.js +0 -310
  20. data/lib/public/javascripts/Jit/Examples/Hypertree/example3.html +0 -199
  21. data/lib/public/javascripts/Jit/Examples/Hypertree/example3.js +0 -615
  22. data/lib/public/javascripts/Jit/Examples/Other/example1.html +0 -58
  23. data/lib/public/javascripts/Jit/Examples/Other/example1.js +0 -566
  24. data/lib/public/javascripts/Jit/Examples/Other/example2.html +0 -58
  25. data/lib/public/javascripts/Jit/Examples/Other/example2.js +0 -304
  26. data/lib/public/javascripts/Jit/Examples/Other/example3.html +0 -58
  27. data/lib/public/javascripts/Jit/Examples/Other/example3.js +0 -304
  28. data/lib/public/javascripts/Jit/Examples/RGraph/example1.html +0 -57
  29. data/lib/public/javascripts/Jit/Examples/RGraph/example1.js +0 -475
  30. data/lib/public/javascripts/Jit/Examples/RGraph/example2.html +0 -58
  31. data/lib/public/javascripts/Jit/Examples/RGraph/example2.js +0 -356
  32. data/lib/public/javascripts/Jit/Examples/RGraph/example3.html +0 -199
  33. data/lib/public/javascripts/Jit/Examples/RGraph/example3.js +0 -622
  34. data/lib/public/javascripts/Jit/Examples/Spacetree/example1.html +0 -91
  35. data/lib/public/javascripts/Jit/Examples/Spacetree/example1.js +0 -890
  36. data/lib/public/javascripts/Jit/Examples/Spacetree/example2.html +0 -90
  37. data/lib/public/javascripts/Jit/Examples/Spacetree/example2.js +0 -213
  38. data/lib/public/javascripts/Jit/Examples/Spacetree/example3.html +0 -75
  39. data/lib/public/javascripts/Jit/Examples/Spacetree/example3.js +0 -863
  40. data/lib/public/javascripts/Jit/Examples/Treemap/example1.html +0 -56
  41. data/lib/public/javascripts/Jit/Examples/Treemap/example1.js +0 -95
  42. data/lib/public/javascripts/Jit/Examples/Treemap/example2.html +0 -61
  43. data/lib/public/javascripts/Jit/Examples/Treemap/example2.js +0 -750
  44. data/lib/public/javascripts/Jit/Examples/Treemap/example3.html +0 -62
  45. data/lib/public/javascripts/Jit/Examples/Treemap/example3.js +0 -775
  46. data/lib/public/javascripts/Jit/Examples/css/Hypertree.css +0 -0
  47. data/lib/public/javascripts/Jit/Examples/css/Other.css +0 -8
  48. data/lib/public/javascripts/Jit/Examples/css/RGraph.css +0 -0
  49. data/lib/public/javascripts/Jit/Examples/css/Spacetree.css +0 -0
  50. data/lib/public/javascripts/Jit/Examples/css/Treemap.css +0 -78
  51. data/lib/public/javascripts/Jit/Examples/css/base.css +0 -106
  52. data/lib/public/javascripts/Jit/Examples/css/col1.png +0 -0
  53. data/lib/public/javascripts/Jit/Examples/css/col2.png +0 -0
  54. data/lib/public/javascripts/Jit/Examples/css/gradient.png +0 -0
  55. data/lib/public/javascripts/Jit/Extras/excanvas.js +0 -35
  56. data/lib/public/javascripts/Jit/jit-yc.js +0 -1
  57. data/lib/public/javascripts/Jit-1.1.3.zip +0 -0
@@ -1,775 +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
- children: [{
21
- children: [{
22
- children: [],
23
- data: {
24
- $area: "80",
25
- $color: "30",
26
- image: "http://images.amazon.com/images/P/B0007DAZW8.01.MZZZZZZZ.jpg"
27
- },
28
- id: "056e4f3e-d505-4dad-8ec1-d04f521cbb56Human After All",
29
- name: "Human After All"
30
- }],
31
- data: {
32
- $area: 80
33
- },
34
- id: "056e4f3e-d505-4dad-8ec1-d04f521cbb56a",
35
- name: "Daft Punk"
36
- }, {
37
- children: [{
38
- children: [],
39
- data: {
40
- $area: "94",
41
- $color: "23",
42
- image: "http://cdn.last.fm/coverart/130x130/2393956.jpg"
43
- },
44
- id: "f2fa5cf6-e0b0-4559-8641-e033f1a9e6fcClearing the Channel",
45
- name: "Clearing the Channel"
46
- }],
47
- data: {
48
- $area: 94
49
- },
50
- id: "f2fa5cf6-e0b0-4559-8641-e033f1a9e6fca",
51
- name: "Sinch"
52
- }, {
53
- children: [{
54
- children: [],
55
- data: {
56
- $area: "211",
57
- $color: "2",
58
- image: "http://cdn.last.fm/coverart/130x130/2564320-1193176651.jpg"
59
- },
60
- id: "4bd95eea-b9f6-4d70-a36c-cfea77431553Music Bank",
61
- name: "Music Bank"
62
- }],
63
- data: {
64
- $area: 211
65
- },
66
- id: "4bd95eea-b9f6-4d70-a36c-cfea77431553a",
67
- name: "Alice in Chains"
68
- }, {
69
- children: [{
70
- children: [],
71
- data: {
72
- $area: "153",
73
- $color: "6",
74
- image: "http://userserve-ak.last.fm/serve/174s/8590493.jpg"
75
- },
76
- id: "8bfac288-ccc5-448d-9573-c33ea2aa5c30One Hot Minute",
77
- name: "One Hot Minute"
78
- }, {
79
- children: [],
80
- data: {
81
- $area: "69",
82
- $color: "35",
83
- image: "http://userserve-ak.last.fm/serve/174s/8593509.jpg"
84
- },
85
- id: "8bfac288-ccc5-448d-9573-c33ea2aa5c30Californication",
86
- name: "Californication"
87
- }, {
88
- children: [],
89
- data: {
90
- $area: "69",
91
- $color: "35",
92
- image: "http://userserve-ak.last.fm/serve/174s/8672727.jpg"
93
- },
94
- id: "8bfac288-ccc5-448d-9573-c33ea2aa5c30Greatest Hits",
95
- name: "Greatest Hits"
96
- }],
97
- data: {
98
- $area: 291
99
- },
100
- id: "8bfac288-ccc5-448d-9573-c33ea2aa5c30a",
101
- name: "Red Hot Chili Peppers"
102
- }, {
103
- children: [{
104
- children: [],
105
- data: {
106
- $area: "114",
107
- $color: "15",
108
- image: "http://images.amazon.com/images/P/B0000UX5IY.01._SCMZZZZZZZ_.jpg"
109
- },
110
- id: "ff6e677f-91dd-4986-a174-8db0474b1799Thicker Than Water",
111
- name: "Thicker Than Water"
112
- }, {
113
- children: [],
114
- data: {
115
- $area: "83",
116
- $color: "28",
117
- image: "http://userserve-ak.last.fm/serve/174s/8599099.jpg"
118
- },
119
- id: "ff6e677f-91dd-4986-a174-8db0474b1799On and On",
120
- name: "On and On"
121
- }, {
122
- children: [],
123
- data: {
124
- $area: "62",
125
- $color: "41",
126
- image: "http://userserve-ak.last.fm/serve/174s/8664981.jpg"
127
- },
128
- id: "ff6e677f-91dd-4986-a174-8db0474b1799Brushfire Fairytales",
129
- name: "Brushfire Fairytales"
130
- }],
131
- data: {
132
- $area: 259
133
- },
134
- id: "ff6e677f-91dd-4986-a174-8db0474b1799a",
135
- name: "Jack Johnson"
136
- }, {
137
- children: [{
138
- children: [],
139
- data: {
140
- $area: "65",
141
- $color: "38",
142
- image: "http://userserve-ak.last.fm/serve/174s/23727633.jpg"
143
- },
144
- id: "83b9cbe7-9857-49e2-ab8e-b57b01038103Vs.",
145
- name: "Vs."
146
- }, {
147
- children: [],
148
- data: {
149
- $area: "61",
150
- $color: "44",
151
- image: "http://userserve-ak.last.fm/serve/174s/19611679.jpg"
152
- },
153
- id: "83b9cbe7-9857-49e2-ab8e-b57b01038103Riot Act",
154
- name: "Riot Act"
155
- }, {
156
- children: [],
157
- data: {
158
- $area: "61",
159
- $color: "44",
160
- image: "http://userserve-ak.last.fm/serve/174s/17492447.jpg"
161
- },
162
- id: "83b9cbe7-9857-49e2-ab8e-b57b01038103Yield",
163
- name: "Yield"
164
- }],
165
- data: {
166
- $area: 187
167
- },
168
- id: "83b9cbe7-9857-49e2-ab8e-b57b01038103a",
169
- name: "Pearl Jam"
170
- }, {
171
- children: [{
172
- children: [],
173
- data: {
174
- $area: "115",
175
- $color: "14",
176
- image: "http://userserve-ak.last.fm/serve/174s/17484209.jpg"
177
- },
178
- id: "bfd085b8-0bbf-46b3-8ab9-193bca5c85e7Above",
179
- name: "Above"
180
- }],
181
- data: {
182
- $area: 115
183
- },
184
- id: "bfd085b8-0bbf-46b3-8ab9-193bca5c85e7a",
185
- name: "Mad Season"
186
- }, {
187
- children: [{
188
- children: [],
189
- data: {
190
- $area: "108",
191
- $color: "17",
192
- image: "http://images.amazon.com/images/P/B000002J8M.01._SCMZZZZZZZ_.jpg"
193
- },
194
- id: "8c32bb01-58a3-453b-8050-8c0620edb0e5Tiny Music... Songs From the Vatican Gift Shop",
195
- name: "Tiny Music... Songs From the Vatican Gift Shop"
196
- }, {
197
- children: [],
198
- data: {
199
- $area: "60",
200
- $color: "46",
201
- image: "http://images.amazon.com/images/P/B000002IU3.01.MZZZZZZZ.jpg"
202
- },
203
- id: "8c32bb01-58a3-453b-8050-8c0620edb0e5Core",
204
- name: "Core"
205
- }],
206
- data: {
207
- $area: 168
208
- },
209
- id: "8c32bb01-58a3-453b-8050-8c0620edb0e5a",
210
- name: "Stone Temple Pilots"
211
- }, {
212
- children: [{
213
- children: [],
214
- data: {
215
- $area: "63",
216
- $color: "40",
217
- image: "http://images.amazon.com/images/P/B00005NWLC.01.MZZZZZZZ.jpg"
218
- },
219
- id: "7b2f87f6-db90-464e-a27a-deb4f7219e90Leitmotif",
220
- name: "Leitmotif"
221
- }],
222
- data: {
223
- $area: 63
224
- },
225
- id: "7b2f87f6-db90-464e-a27a-deb4f7219e90a",
226
- name: "dredg"
227
- }, {
228
- children: [{
229
- children: [],
230
- data: {
231
- $area: "188",
232
- $color: "3",
233
- image: "http://images.amazon.com/images/P/B000EULJLU.01._SCMZZZZZZZ_.jpg"
234
- },
235
- id: "66fc5bf8-daa4-4241-b378-9bc9077939d210,000 Days",
236
- name: "10,000 Days"
237
- }],
238
- data: {
239
- $area: 188
240
- },
241
- id: "66fc5bf8-daa4-4241-b378-9bc9077939d2a",
242
- name: "Tool"
243
- }, {
244
- children: [{
245
- children: [],
246
- data: {
247
- $area: "62",
248
- $color: "41",
249
- image: "http://images.amazon.com/images/P/B00001P4TH.01._SCMZZZZZZZ_.jpg"
250
- },
251
- id: "b7ffd2af-418f-4be2-bdd1-22f8b48613daThe Fragile (Left)",
252
- name: "The Fragile (Left)"
253
- }],
254
- data: {
255
- $area: 62
256
- },
257
- id: "b7ffd2af-418f-4be2-bdd1-22f8b48613daa",
258
- name: "Nine Inch Nails"
259
- }, {
260
- children: [{
261
- children: [],
262
- data: {
263
- $area: "240",
264
- $color: "1",
265
- image: "http://userserve-ak.last.fm/serve/174s/21881921.jpg"
266
- },
267
- id: "a5585acd-9b65-49a7-a63b-3cc4ee18846eMother Love Bone",
268
- name: "Mother Love Bone"
269
- }],
270
- data: {
271
- $area: 240
272
- },
273
- id: "a5585acd-9b65-49a7-a63b-3cc4ee18846ea",
274
- name: "Mother Love Bone"
275
- }, {
276
- children: [{
277
- children: [],
278
- data: {
279
- $area: "67",
280
- $color: "37",
281
- image: "http://userserve-ak.last.fm/serve/174s/8634595.jpg"
282
- },
283
- id: "7527f6c2-d762-4b88-b5e2-9244f1e34c46Around the Fur",
284
- name: "Around the Fur"
285
- }],
286
- data: {
287
- $area: 67
288
- },
289
- id: "7527f6c2-d762-4b88-b5e2-9244f1e34c46a",
290
- name: "Deftones"
291
- }, {
292
- children: [{
293
- children: [],
294
- data: {
295
- $area: "62",
296
- $color: "41",
297
- image: "http://images.amazon.com/images/P/B0000A5BYD.03.MZZZZZZZ.jpg"
298
- },
299
- id: "7bdb6921-8380-422c-8514-87cf30d5d8ccIt All Makes Sense Now",
300
- name: "It All Makes Sense Now"
301
- }],
302
- data: {
303
- $area: 62
304
- },
305
- id: "7bdb6921-8380-422c-8514-87cf30d5d8cca",
306
- name: "Kr\xF3m"
307
- }, {
308
- children: [{
309
- children: [],
310
- data: {
311
- $area: "57",
312
- $color: "48",
313
- image: "http://images-eu.amazon.com/images/P/B00005IABM.02.MZZZZZZZ.jpg"
314
- },
315
- id: "cb67438a-7f50-4f2b-a6f1-2bb2729fd53810,000 Hz Legend",
316
- name: "10,000 Hz Legend"
317
- }],
318
- data: {
319
- $area: 57
320
- },
321
- id: "cb67438a-7f50-4f2b-a6f1-2bb2729fd538a",
322
- name: "Air"
323
- }, {
324
- children: [{
325
- children: [],
326
- data: {
327
- $area: "168",
328
- $color: "5",
329
- image: "http://userserve-ak.last.fm/serve/174s/23091681.jpg"
330
- },
331
- id: "c5998351-be49-49d8-8593-3e96f129c1fcMamagubida",
332
- name: "Mamagubida"
333
- }, {
334
- children: [],
335
- data: {
336
- $area: "141",
337
- $color: "7",
338
- image: "http://cdn.last.fm/flatness/catalogue/noimage/2/default_album_mega.png"
339
- },
340
- id: "c5998351-be49-49d8-8593-3e96f129c1fcReggae \xE0 Coup de Cirque",
341
- name: "Reggae \xE0 Coup de Cirque"
342
- }, {
343
- children: [],
344
- data: {
345
- $area: "135",
346
- $color: "8",
347
- image: "http://userserve-ak.last.fm/serve/174s/16799743.jpg"
348
- },
349
- id: "c5998351-be49-49d8-8593-3e96f129c1fcGrain de sable",
350
- name: "Grain de sable"
351
- }, {
352
- children: [],
353
- data: {
354
- $area: "80",
355
- $color: "30",
356
- image: "http://userserve-ak.last.fm/serve/174s/8635653.jpg"
357
- },
358
- id: "c5998351-be49-49d8-8593-3e96f129c1fcFaut qu'ils s'activent...",
359
- name: "Faut qu'ils s'activent..."
360
- }],
361
- data: {
362
- $area: 524
363
- },
364
- id: "c5998351-be49-49d8-8593-3e96f129c1fca",
365
- name: "Tryo"
366
- }, {
367
- children: [{
368
- children: [],
369
- data: {
370
- $area: "57",
371
- $color: "48",
372
- image: "http://userserve-ak.last.fm/serve/174s/8634627.jpg"
373
- },
374
- id: "4bb4e4e4-5f66-4509-98af-62dbb90c45c5The Sickness",
375
- name: "The Sickness"
376
- }],
377
- data: {
378
- $area: 57
379
- },
380
- id: "4bb4e4e4-5f66-4509-98af-62dbb90c45c5a",
381
- name: "Disturbed"
382
- }, {
383
- children: [{
384
- children: [],
385
- data: {
386
- $area: "72",
387
- $color: "34",
388
- image: "http://userserve-ak.last.fm/serve/174s/8673813.jpg"
389
- },
390
- id: "95f5b748-d370-47fe-85bd-0af2dc450bc0Second-Hand Smoke",
391
- name: "Second-Hand Smoke"
392
- }],
393
- data: {
394
- $area: 72
395
- },
396
- id: "95f5b748-d370-47fe-85bd-0af2dc450bc0a",
397
- name: "Sublime"
398
- }, {
399
- children: [{
400
- children: [],
401
- data: {
402
- $area: "73",
403
- $color: "33",
404
- image: "http://userserve-ak.last.fm/serve/174s/7737695.jpg"
405
- },
406
- id: "020bfbb4-05c3-4c86-b372-17825c262094Audioslave",
407
- name: "Audioslave"
408
- }],
409
- data: {
410
- $area: 73
411
- },
412
- id: "020bfbb4-05c3-4c86-b372-17825c262094a",
413
- name: "Audioslave"
414
- }, {
415
- children: [{
416
- children: [],
417
- data: {
418
- $area: "124",
419
- $color: "10",
420
- image: "http://userserve-ak.last.fm/serve/174s/8605651.jpg"
421
- },
422
- id: "e9571c17-817f-4d34-ae3f-0c7a96f822c1Temple of the Dog",
423
- name: "Temple of the Dog"
424
- }],
425
- data: {
426
- $area: 124
427
- },
428
- id: "e9571c17-817f-4d34-ae3f-0c7a96f822c1a",
429
- name: "Temple of the Dog"
430
- }, {
431
- children: [{
432
- children: [],
433
- data: {
434
- $area: "82",
435
- $color: "29",
436
- image: "http://images.amazon.com/images/P/B0002ZEUKO.01._SCMZZZZZZZ_.jpg"
437
- },
438
- id: "06fb1c8b-566e-4cb2-985b-b467c90781d4Are You Experienced?",
439
- name: "Are You Experienced?"
440
- }, {
441
- children: [],
442
- data: {
443
- $area: "64",
444
- $color: "39",
445
- image: "http://userserve-ak.last.fm/serve/174s/8729219.jpg"
446
- },
447
- id: "06fb1c8b-566e-4cb2-985b-b467c90781d4First Rays of the New Rising Sun",
448
- name: "First Rays of the New Rising Sun"
449
- }],
450
- data: {
451
- $area: 146
452
- },
453
- id: "06fb1c8b-566e-4cb2-985b-b467c90781d4a",
454
- name: "Jimi Hendrix"
455
- }, {
456
- children: [{
457
- children: [],
458
- data: {
459
- $area: "56",
460
- $color: "50",
461
- image: "http://images.amazon.com/images/P/B0000DZDYN.01.MZZZZZZZ.jpg"
462
- },
463
- id: "fbd2a255-1d57-4d31-ac11-65b671c19958The Singles 1992-2003",
464
- name: "The Singles 1992-2003"
465
- }],
466
- data: {
467
- $area: 56
468
- },
469
- id: "fbd2a255-1d57-4d31-ac11-65b671c19958a",
470
- name: "No Doubt"
471
- }, {
472
- children: [{
473
- children: [],
474
- data: {
475
- $area: "123",
476
- $color: "11",
477
- image: "http://userserve-ak.last.fm/serve/174s/11393921.jpg"
478
- },
479
- id: "078a9376-3c04-4280-b7d7-b20e158f345dMer de Noms",
480
- name: "Mer de Noms"
481
- }, {
482
- children: [],
483
- data: {
484
- $area: "93",
485
- $color: "24",
486
- image: "http://userserve-ak.last.fm/serve/174s/11403219.jpg"
487
- },
488
- id: "078a9376-3c04-4280-b7d7-b20e158f345dThirteenth Step",
489
- name: "Thirteenth Step"
490
- }],
491
- data: {
492
- $area: 216
493
- },
494
- id: "078a9376-3c04-4280-b7d7-b20e158f345da",
495
- name: "A Perfect Circle"
496
- }, {
497
- children: [{
498
- children: [],
499
- data: {
500
- $area: "109",
501
- $color: "16",
502
- image: "http://images.amazon.com/images/P/B00005LNP5.01._SCMZZZZZZZ_.jpg"
503
- },
504
- id: "1fc56cff-f0a0-4ce2-ab1f-ac49cf3b073fElija y Gane",
505
- name: "Elija y Gane"
506
- }, {
507
- children: [],
508
- data: {
509
- $area: "85",
510
- $color: "26",
511
- image: "http://images.amazon.com/images/P/B0000B193V.01._SCMZZZZZZZ_.jpg"
512
- },
513
- id: "1fc56cff-f0a0-4ce2-ab1f-ac49cf3b073fPara los Arboles",
514
- name: "Para los Arboles"
515
- }],
516
- data: {
517
- $area: 194
518
- },
519
- id: "1fc56cff-f0a0-4ce2-ab1f-ac49cf3b073fa",
520
- name: "Luis Alberto Spinetta"
521
- }, {
522
- children: [{
523
- children: [],
524
- data: {
525
- $area: "87",
526
- $color: "25",
527
- image: "http://userserve-ak.last.fm/serve/174s/8772827.jpg"
528
- },
529
- id: "e795e03d-b5d5-4a5f-834d-162cfb308a2c4-Track Demos",
530
- name: "4-Track Demos"
531
- }, {
532
- children: [],
533
- data: {
534
- $area: "77",
535
- $color: "32",
536
- image: "http://userserve-ak.last.fm/serve/174s/9929071.jpg"
537
- },
538
- id: "e795e03d-b5d5-4a5f-834d-162cfb308a2cRid of Me",
539
- name: "Rid of Me"
540
- }],
541
- data: {
542
- $area: 164
543
- },
544
- id: "e795e03d-b5d5-4a5f-834d-162cfb308a2ca",
545
- name: "PJ Harvey"
546
- }, {
547
- children: [{
548
- children: [],
549
- data: {
550
- $area: "102",
551
- $color: "19",
552
- image: "http://userserve-ak.last.fm/serve/174s/7410551.jpg"
553
- },
554
- id: "e3e0abcd-7671-4482-a9d8-462f5acc9be5Make Yourself",
555
- name: "Make Yourself"
556
- }, {
557
- children: [],
558
- data: {
559
- $area: "84",
560
- $color: "27",
561
- image: "http://images.amazon.com/images/P/B00018D5CQ.01._SCMZZZZZZZ_.jpg"
562
- },
563
- id: "e3e0abcd-7671-4482-a9d8-462f5acc9be5A Crow Left of the Murder",
564
- name: "A Crow Left of the Murder"
565
- }, {
566
- children: [],
567
- data: {
568
- $area: "60",
569
- $color: "46",
570
- image: "http://userserve-ak.last.fm/serve/174s/19681051.jpg"
571
- },
572
- id: "e3e0abcd-7671-4482-a9d8-462f5acc9be5Morning View",
573
- name: "Morning View"
574
- }],
575
- data: {
576
- $area: 246
577
- },
578
- id: "e3e0abcd-7671-4482-a9d8-462f5acc9be5a",
579
- name: "Incubus"
580
- }, {
581
- children: [{
582
- children: [],
583
- data: {
584
- $area: "130",
585
- $color: "9",
586
- image: "http://userserve-ak.last.fm/serve/174s/15113951.jpg"
587
- },
588
- id: "38c5cdab-5d6d-43d1-85b0-dac41bde186eNico",
589
- name: "Nico"
590
- }, {
591
- children: [],
592
- data: {
593
- $area: "120",
594
- $color: "12",
595
- image: "http://images.amazon.com/images/P/B00005V5PW.01.MZZZZZZZ.jpg"
596
- },
597
- id: "38c5cdab-5d6d-43d1-85b0-dac41bde186eClassic Masters",
598
- name: "Classic Masters"
599
- }, {
600
- children: [],
601
- data: {
602
- $area: "103",
603
- $color: "18",
604
- image: "http://images.amazon.com/images/P/B000002TPF.01.MZZZZZZZ.jpg"
605
- },
606
- id: "38c5cdab-5d6d-43d1-85b0-dac41bde186eSoup",
607
- name: "Soup"
608
- }, {
609
- children: [],
610
- data: {
611
- $area: "99",
612
- $color: "20",
613
- image: "http://userserve-ak.last.fm/serve/174s/15157989.jpg"
614
- },
615
- id: "38c5cdab-5d6d-43d1-85b0-dac41bde186eBlind Melon",
616
- name: "Blind Melon"
617
- }],
618
- data: {
619
- $area: 452
620
- },
621
- id: "38c5cdab-5d6d-43d1-85b0-dac41bde186ea",
622
- name: "Blind Melon"
623
- }, {
624
- children: [{
625
- children: [],
626
- data: {
627
- $area: "173",
628
- $color: "4",
629
- image: "http://userserve-ak.last.fm/serve/174s/8590515.jpg"
630
- },
631
- id: "153c9281-268f-4cf3-8938-f5a4593e5df4Superunknown",
632
- name: "Superunknown"
633
- }, {
634
- children: [],
635
- data: {
636
- $area: "117",
637
- $color: "13",
638
- image: "http://userserve-ak.last.fm/serve/174s/5269310.jpg"
639
- },
640
- id: "153c9281-268f-4cf3-8938-f5a4593e5df4Louder Than Love",
641
- name: "Louder Than Love"
642
- }, {
643
- children: [],
644
- data: {
645
- $area: "96",
646
- $color: "21",
647
- image: "http://userserve-ak.last.fm/serve/174s/8600371.jpg"
648
- },
649
- id: "153c9281-268f-4cf3-8938-f5a4593e5df4Down on the Upside",
650
- name: "Down on the Upside"
651
- }, {
652
- children: [],
653
- data: {
654
- $area: "95",
655
- $color: "22",
656
- image: "http://images.amazon.com/images/P/B000000M4A.01.MZZZZZZZ.jpg"
657
- },
658
- id: "153c9281-268f-4cf3-8938-f5a4593e5df4Ultramega OK",
659
- name: "Ultramega OK"
660
- }],
661
- data: {
662
- $area: 481
663
- },
664
- id: "153c9281-268f-4cf3-8938-f5a4593e5df4a",
665
- name: "Soundgarden"
666
- }],
667
- data: {
668
- $area: 4949
669
- },
670
- id: "topAlbums",
671
- name: "top albums"
672
- };
673
- //end
674
-
675
- var infovis = document.getElementById('infovis');
676
- var w = infovis.offsetWidth, h = infovis.offsetHeight;
677
- infovis.style.width = w + 'px';
678
- infovis.style.height = h + 'px';
679
-
680
- //init tm
681
- //You can also do TM.SliceAndDice and TM.Squarified
682
- var tm = new TM.Strip({
683
- //Where to inject the treemap.
684
- rootId: 'infovis',
685
-
686
- titleHeight: 0,
687
- orientation: "h",
688
- offset: 0,
689
-
690
- //Add click handlers for
691
- //zooming the Treemap in and out
692
- addLeftClickHandler: true,
693
- addRightClickHandler: true,
694
-
695
- //When hovering a node highlight the nodes
696
- //between the root node and the hovered node. This
697
- //is done by adding the 'in-path' CSS class to each node.
698
- selectPathOnHover: true,
699
-
700
- Color: {
701
- //Allow coloring
702
- allow: true,
703
- //Set min value and max value constraints
704
- //for the *$color* property value.
705
- //Default's to -100 and 100.
706
- minValue: 1,
707
- maxValue: 50,
708
- //Set color range. Default's to reddish and greenish.
709
- //It takes an array of three
710
- //integers as R, G and B values.
711
- minColorValue: [0, 255, 50],
712
- maxColorValue: [255, 0, 50]
713
- },
714
-
715
- //Allow tips
716
- Tips: {
717
- allow: true,
718
- //add positioning offsets
719
- offsetX: 20,
720
- offsetY: 20,
721
- //implement the onShow method to
722
- //add content to the tooltip when a node
723
- //is hovered
724
- onShow: function(tip, node, isLeaf, domElement) {
725
- tip.innerHTML = "<div class=\"tip-title\">" + node.name + "</div>" +
726
- "<div class=\"tip-text\">" + this.makeHTMLFromData(node.data) + "</div>";
727
- },
728
-
729
- //Build the tooltip inner html by taking each node data property
730
- makeHTMLFromData: function(data){
731
- var html = '';
732
- html += "playcount" + ': ' + data.$area + '<br />';
733
- if ("$color" in data)
734
- html += "rank" + ': ' + data.$color + '<br />';
735
- if ("image" in data)
736
- html += "<img class=\"album\" src=\"" + data.image + "\" />";
737
- return html;
738
- }
739
- },
740
-
741
- //This method is invoked when a DOM element is created.
742
- //Its useful to set DOM event handlers here or manipulate
743
- //the DOM Treemap nodes.
744
- onCreateElement: function(content, tree, isLeaf, leaf){
745
- //Add background image
746
- if(isLeaf) {
747
- var style = leaf.style,
748
- width = parseInt(style.width) - 2,
749
- height = parseInt(style.height) - 2;
750
-
751
- leaf.innerHTML = tree.name +
752
- "<img src=\"../css/gradient.png\" " +
753
- " style=\"position:absolute;top:0;left:0;width:" +
754
- width + "px;height:" + height + "px;\" />";
755
-
756
- style.width = width + "px";
757
- style.height = height + "px";
758
- }
759
- },
760
-
761
- //Remove all events for the element before destroying it.
762
- onDestroyElement: function(content, tree, isLeaf, leaf){
763
- if(leaf.clearAttributes) leaf.clearAttributes();
764
- }
765
- });
766
-
767
- //load JSON and plot
768
- tm.loadJSON(json);
769
- //end
770
-
771
- document.getElementById('out_button').onclick = function(){
772
- tm.out();
773
- };
774
-
775
- }