Skip to content

Instantly share code, notes, and snippets.

@enjalot
Created October 29, 2012 04:47
Show Gist options
  • Select an option

  • Save enjalot/3971578 to your computer and use it in GitHub Desktop.

Select an option

Save enjalot/3971578 to your computer and use it in GitHub Desktop.
just another inlet to tributary
{"endpoint":"","display":"svg","public":true,"require":[],"tab":"edit","display_percent":0.7,"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}
var hourwidth = 25;
var svg = d3.select("svg")
.append("svg:g")
var chart = svg.append("g")
.attr({
transform: "translate("+66+","+25+")"
})
var start = new Date(2012, 0, 1);
var end = new Date(2012, 0, 2);
hourscale = d3.time.hours(start, end);
hour12 = d3.time.format("%I");
hour24 = d3.time.format("%H");
chart.selectAll(".hour")
.data(hourscale)
.enter()
.append("rect")
.attr({
x: function(d,i) {
console.log(">", d);
return hour12(d)*(hourwidth*1.104)
},
y: function(d,i){
return parseInt(hour24(d)/12) * (hourwidth + 5);
},
width: hourwidth,
height: hourwidth
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment