forked from orezeni/orezeni.github.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bubbletree.html
72 lines (65 loc) · 1.88 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
---
layout: default
title: 使途別予算額
---
<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/setting.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': OpenSpending.Styles.Cofog,
},
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: OpenSpending.identifier,
rootNodeLabel: 'Total',
drilldowns: ['Category', 'Subcategory'],
cuts: ['year:' + OpenSpending.year],
breakdown: 'Subcategory',
callback: dataLoaded
});
});
}
});
</script>
<div class="bubbletree-wrapper">
<div id="bubbletree" class="bubbletree"></div>
</div>
</div>