Permalink
Browse files

fixed cra demo

  • Loading branch information...
1 parent 39782da commit 1e9a133c91cb50d6c90f9878e0a5ec3106b05cce gka committed Jul 9, 2011
Showing with 13 additions and 10 deletions.
  1. +9 −8 demos/cra/index.html
  2. +4 −2 styles/cofog.js
View
@@ -9,8 +9,7 @@
<script type="text/javascript" src="../../lib/vis4.js"></script>
<script type="text/javascript" src="../../lib/Tween.js"></script>
<script type="text/javascript" src="../../build/bubbletree.js"></script>
- <script type="text/javascript" src="../../../openspendingjs/lib/aggregator.js"></script>
-
+ <script type="text/javascript" src="../../../openspendingjs/lib/aggregator.js"></script>
<link rel="stylesheet" type="text/css" href="../../build/bubbletree.css" />
<script type="text/javascript" src="../../styles/cofog.js"></script>
@@ -41,14 +40,13 @@
};
var dataLoaded = function(data) {
- console.log('dataLoaded', data);
- new OpenSpending.BubbleTree.Loader({
+ console.log('dataLoaded', JSON.stringify(data));
+ window.bubbleTree = new BubbleTree({
data: data,
container: '.bubbletree',
- rootNodeLabel: 'Grant total',
bubbleType: 'icon',
bubbleStyles: {
- 'cofog': OpenSpending.BubbleTree.Styles.Cofog
+ 'cofog': BubbleTree.Styles.Cofog
},
rootPath: '../../',
tooltipCallback: tooltip
@@ -59,6 +57,7 @@
new OpenSpending.Aggregator({
apiUrl: 'http://openspending.org/api',
dataset: 'cra',
+ rootNodeLabel: 'Grant total',
drilldowns: ['cofog1', 'cofog2', 'cofog3'],
cuts: ['year:2008'],
breakdown: 'region',
@@ -72,8 +71,10 @@
</script>
</head>
<body>
- <div id="header"><a class="title">OpenSpending</a>
- <div class="subtitle">UK Country Regional Analysis</div></div>
+ <div id="header">
+ <a class="title">OpenSpending</a>
+ <div class="subtitle">UK Country Regional Analysis</div>
+ </div>
<div class="bubbletree-wrapper">
<div class="bubbletree"></div>
</div>
View
@@ -3,9 +3,11 @@
*
*/
-if (!OpenSpending || !OpenSpending.BubbleTree) window.alert('You must include the BubbleTree before including the styles');
+if (!BubbleTree) window.alert('You must include the BubbleTree before including the styles');
-OpenSpending.BubbleTree.Styles.Cofog = {
+BubbleTree.Styles = BubbleTree.Styles || {};
+
+BubbleTree.Styles.Cofog = {
'01': { icon: 'styles/icons/government-uk.svg', color: '#C75746' },
'01.1': { icon: 'styles/icons/legislative.svg' },
'01.1.1': { icon: 'styles/icons/legislative.svg' },

0 comments on commit 1e9a133

Please sign in to comment.