forked from orezeni/orezeni.github.com
-
Notifications
You must be signed in to change notification settings - Fork 4
/
bubbletree.html
74 lines (67 loc) · 1.81 KB
/
bubbletree.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
---
layout: default
title: Country Regional Analysis
---
<div class="row">
<script type="text/javascript">
yepnope.errorTimeout = 1000;
yepnope({
load: [
'/js/libs/jquery.qtip.min.js',
'/js/libs/jquery.history.js',
'/js/libs/raphael-min.js',
'/js/libs/vis4.js',
'/js/libs/base64.js',
'/js/libs/Tween.js',
'/js/bubbletree.js',
'/css/bubbletree.css',
'/css/cra-map.css',
'/js/aggregator.js',
'/js/bubbletree.cofog.js'
],
complete: function() {
$(function() {
var $tooltip = $('<div class="tooltip">Tooltip</div>');
$('.bubbletree').append($tooltip);
$tooltip.hide();
var dataLoaded = function(data) {
window.bubbleTree = new BubbleTree({
data: data,
container: '#bubbletree',
bubbleType: 'icon',
bubbleStyles: {
'cofog-1': BubbleTree.Styles.Cofog1,
'cofog-2': BubbleTree.Styles.Cofog2,
'cofog-3': BubbleTree.Styles.Cofog3
},
clearColors: true, // remove all colors coming from OpenSpending API
rootPath: '/',
tooltip: {
qtip: true,
delay: 800,
content: function(node) {
return [node.label, '<div class="desc">'+(node.description ? node.description : 'No description given')+'</div><div class="amount">\u00A5 '+node.famount+'</div>'];
}
}
});
};
// call openspending api for data
new OpenSpending.Aggregator({
//apiUrl: 'http://openspending.org/api',
//Use static file instead of api
localApiCache: 'aggregate.json',
dataset: 'ukgov-finances-cra',
rootNodeLabel: 'Total',
drilldowns: ['cofog1', 'cofog2'],
cuts: ['year:2008'],
breakdown: 'region',
callback: dataLoaded
});
});
}
});
</script>
<div class="bubbletree-wrapper">
<div id="bubbletree" class="bubbletree"></div>
</div>
</div>