Skip to content

Instantly share code, notes, and snippets.

@erikhazzard
Created June 29, 2012 05:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save erikhazzard/3015945 to your computer and use it in GitHub Desktop.
Save erikhazzard/3015945 to your computer and use it in GitHub Desktop.
just another inlet to tributary
var p=d3.scale.category10();
var r=p.range(); // ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
// "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"]
var s=d3.scale.ordinal().range(r);
p.domain(); // [] - empty
s.domain(); // [] - empty, see above
console.log(p(0)); // "#1f77b4"
console.log(p(1)); // "#ff7f0e"
console.log(p(2)); // "#2ca02c"
console.log(p.domain()); // [0,1,2];
console.log(s(0)); // "#1f77b4"
console.log(s(1)); // "#ff7f0e"
console.log(s(2)); // "#2ca02c"
console.log(s.domain()); // [0,1,2];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment