Permalink
Browse files

Add colour to example.

  • Loading branch information...
1 parent e3db3c9 commit 6103e1500e56c3ffd5f89ed04f79e4e897d347c5 @jasondavies committed Nov 10, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 examples/simple.html
View
@@ -2,6 +2,8 @@
<script src="../d3.layout.cloud.js"></script>
<body>
<script>
+ var fill = d3.scale.category20();
+
d3.layout.cloud().size([300, 300])
.words([
"Hello", "world", "normally", "you", "want", "more", "words",
@@ -25,6 +27,7 @@
.enter().append("text")
.style("font-size", function(d) { return d.size + "px"; })
.style("font-family", "Impact")
+ .style("fill", function(d, i) { return fill(i); })
.attr("text-anchor", "middle")
.attr("transform", function(d) {
return "translate(" + [d.x, d.y] + ")rotate(" + d.rotate + ")";

0 comments on commit 6103e15

Please sign in to comment.