User:Themsen/Protclass7: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:


<code>
<code>
<meta charset="utf-8" />
<meta charset="utf-8" />
<script src="d3.min.js"></script>
<script src="d3.min.js"></script>
<body>
<body>
 
<div id="content"></div>
<div id="content"></div>
 
 
</body>
</body>
<script>
<script>
 
d3.json("words2.json", function (data) {
d3.json("words2.json", function (data) {
console.log("loaded", data);
console.log("loaded", data);
d3.select("#content")
d3.select("#content")
Line 24: Line 24:
return d.count
return d.count
})
})
 
})
})
 
</script>
</script>
</code>
</code>

Latest revision as of 19:20, 28 April 2015

words.html

<meta charset="utf-8" /> <script src="d3.min.js"></script> <body>

</body> <script>

d3.json("words2.json", function (data) { console.log("loaded", data); d3.select("#content") .selectAll("span") .data(data) .enter() .append("span") .text(function(d) { return d.word + " " }) .style("font-size", function(d) { return d.count })

})

</script>