[ Launch: for kiba ] 6690275 by gelicia
-
-
Save gelicia/6690275 to your computer and use it in GitHub Desktop.
for kiba
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":"for kiba","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/txZnvPO.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 svg = d3.select("svg"); | |
var colors = ["#ffffd9", | |
"#edf8b1", | |
"#c7e9b4", | |
"#7fcdbb", | |
"#41b6c4", | |
"#1d91c0", | |
"#225ea8", | |
"#253494", | |
"#081d58"]; | |
var data = | |
[ | |
[2,0,4,3,3,5,7], | |
[2,3,1,1,1,1,1], | |
[4,3,5,2,3,5,6], | |
[8,3,3,3,3,3,2] | |
]; | |
var rows = svg.selectAll("g.row") | |
.data(data) | |
var rowsEnter = rows.enter() | |
.append("g") | |
.attr("transform", function(d,i) { | |
return "translate(" + [20, 34 + i * 40] + ")"; | |
}) | |
rowsEnter.selectAll("rect.days") | |
.data(function(d) { return d}) | |
.enter() | |
.append("rect") | |
.attr("x", function(d,i) {console.log(d);return i * 21;}) | |
.attr("width", 20) | |
.attr("height", 20) | |
.attr("fill", function(d) {return colors[d];}) | |
.classed("days", true); | |
var weekly = [24,40,28,25]; | |
svg.selectAll("rect.week") | |
.data(weekly) | |
.enter() | |
.append("rect") | |
.attr("x", 8 * 21) | |
.attr("y", function(d) { | |
if (d <= 40) | |
{ | |
return colors[Math.floor(d / 5)]; | |
} | |
else | |
{ | |
return colors[7]; | |
} | |
}) | |
.attr("width",30) | |
.attr("height",31) | |
.classed("week", true); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment