Created
September 2, 2011 08:01
-
-
Save studioijeoma/1188138 to your computer and use it in GitHub Desktop.
flexmotion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html lang="en"> | |
<head> | |
<title>d3 load treemap json</title> | |
<meta charset="utf-8"> | |
<style type="text/css"> | |
body { | |
font-family:Monospace; | |
background-color:#f0f0f0; | |
margin:0px; | |
overflow:hidden; | |
} | |
</style> | |
</head> | |
<body> | |
<script type="text/javascript" src="js/d3.js"></script> | |
<script type="text/javascript"> | |
loadData(); | |
test2("everything loaded"); | |
function loadData() { | |
loadProducts("data/products.json") | |
loadTreemap("data/treemap.json"); | |
// test2("everything loaded"); | |
} | |
function loadProducts(file) { | |
d3.json(file, function(json) { | |
var productsData = eval(json.products); | |
for(var i in productsData) { | |
var data = productsData[i]; | |
} | |
test1("products loaded"); | |
}); | |
} | |
function loadTreemap(file) { | |
d3.json(file, function(json) { | |
var treemapData = eval(json.items); | |
var W = 800; | |
var H = 600; | |
for(var i in treemapData) { | |
var data = treemapData[i]; | |
} | |
test1("treemap loaded"); | |
}); | |
} | |
function test1(text) { | |
console.log(text); | |
} | |
function test2(text) { | |
console.log(text); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment