Skip to content

Instantly share code, notes, and snippets.

@enjalot
Created April 4, 2013 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enjalot/5312963 to your computer and use it in GitHub Desktop.
Save enjalot/5312963 to your computer and use it in GitHub Desktop.
d3 colors
{"description":"d3 colors","endpoint":"","display":"div","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"style.css":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"thumbnail":"http://i.imgur.com/p3BPn7y.png"}
var scale = d3.scale.category20()
var svg = d3.select("#display").selectAll("p")
.data(d3.range(20))
.enter()
.append("p")
.text(function(d){ return scale(d) })
.style("color", function(d) { return scale(d) })
#display {
overflow: scroll;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment