[ Launch: Color Pallette ] 9030585 by ljbrown238
-
-
Save ljbrown238/9030585 to your computer and use it in GitHub Desktop.
Color Pallette
This file contains 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
{"description":"Color Pallette","endpoint":"","display":"svg","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}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"thumbnail":"http://i.imgur.com/3VgkPtp.png"} |
This file contains 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
var a = d3.scale.category10(); | |
var b = d3.scale.category20(); | |
var c = d3.scale.category20b(); | |
var d = d3.scale.category20c(); | |
//console.log(a.range()); | |
//console.log(b.range()); | |
//console.log(c.range()); | |
//console.log(d.range()); | |
var svg = d3.select("svg"); | |
var data10 = [1,2,3,4,5,6,7,8,9,10]; | |
var data20 = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]; | |
svg.selectAll("rect a") | |
.data(data10) | |
.enter() | |
.append("rect") | |
.attr("x",function(d,i) { return i*10; }) | |
.attr("y",10) | |
.attr("width",9) | |
.attr("height",20) | |
.attr("fill",a); | |
svg.selectAll("rect b") | |
.data(data10) | |
.enter() | |
.append("rect") | |
.attr("x",function(d,i) { return i*10; }) | |
.attr("y",40) | |
.attr("width",9) | |
.attr("height",20) | |
.attr("fill",b); | |
svg.selectAll("rect c") | |
.data(data20) | |
.enter() | |
.append("rect") | |
.attr("x",function(d,i) { return i*10; }) | |
.attr("y",70) | |
.attr("width",9) | |
.attr("height",20) | |
.attr("fill",c); | |
svg.selectAll("rect d") | |
.data(data20) | |
.enter() | |
.append("rect") | |
.attr("x",function(d,i) { return i*10; }) | |
.attr("y",100) | |
.attr("width",9) | |
.attr("height",20) | |
.attr("fill",d); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment