Skip to content

Instantly share code, notes, and snippets.

@adamclerk
Created October 4, 2012 18:50
Show Gist options
  • Save adamclerk/3835614 to your computer and use it in GitHub Desktop.
Save adamclerk/3835614 to your computer and use it in GitHub Desktop.
just another inlet to tributary

No parent Inlet

{"editor_editor":{"coffee":false,"vim":false,"emacs":false,"width":599,"height":300,"hide":false},"endpoint":"tributary","public":true}
var svg = d3.select("svg");
var data1 = d3.range(144);
var columns = 12;
var size = 48;
var margin = 2;
var xplace = 130;
var yplace = 100;
var rects = svg.selectAll("rect")
.data(data1);
var colorScale = d3.scale.linear()
.domain([d3.min(data1), d3.max(data1)])
.range(["#2E1010", "#E64646"]);
rects.enter()
.append("rect")
.attr({
width:size,
height:size,
y:function(d,i){
return Math.floor(i/columns) * (size + margin) + yplace
},
x:function(d,i){
return (i % columns) * (size+margin) + xplace
},
fill:function(d,i){
return colorScale(d);
}
});
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment