Skip to content

Commit

Permalink
updated data debugger to load from static files
Browse files Browse the repository at this point in the history
  • Loading branch information
themightychris committed Jun 22, 2014
1 parent c319b6f commit 76089e6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions data/budget-list-normalized.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions debug.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8">
</head>
<body>
<script src="{Site::getVersionedRootUrl('js/d3.min.js')}"></script>
<script src="{Site::getVersionedRootUrl('js/debug.js')}"></script>
<script src="js/d3.min.js"></script>
<script src="js/debug.js"></script>
</body>
</html>
14 changes: 7 additions & 7 deletions js/debug.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
d3.json("/api/budget-tree.json?normalized=1", function(error, root) {

var totals = {
current_total: 0,
next_total: 0
},
leafCount = 0;

function _crawlChildren(children) {
for (var i = 0, child; i < children.length; i++) {
child = children[i];

if ('children' in child) {
_crawlChildren(child.children);
} else {
Expand All @@ -19,19 +19,19 @@ d3.json("/api/budget-tree.json?normalized=1", function(error, root) {
}
}
}

_crawlChildren(root.children);
console.log('Tree -- found %o leafs', leafCount);
console.log('Tree -- totals', totals);
});

d3.json("/api/budget-list.json?normalized=1", function(error, root) {
d3.json("data/budget-list-normalized.json", function(error, root) {

var totals = {
current_total: 0,
next_total: 0
};

for (var i = 0, line; i < root.length; i++) {
line = root[i];

Expand Down

0 comments on commit 76089e6

Please sign in to comment.