-
-
Save mschober/4109085 to your computer and use it in GitHub Desktop.
scaling builds
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
{ | |
"build_times": | |
[ | |
140.894, 131.685, 82.825, 67.13, 64.794, 58.199, 52.644, 44.784, 43.634, 43.536, 43.245, 41.782, 40.516, 40.152, 36.701, 33.629, 33.039, 22.708, 22.416, 22.068, 19.25, 15.468, 12.918, 12.507, 11.508, 11.018, 10.288, 9.623, 8.348, 7.071, 6.628, 6.433, 5.699, 5.69, 4.736, 4.664, 3.936, 3.781, 2.889, 2.835, 2.144, 2.005, 1.892, 1.869, 1.809, 1.093, 0.957, 0.929, 0.725, 0.602, 0.565, 0.542, 0.463, 0.434, 0.245, 0.239, 0.238, 0.216, 0.207, 0.191, 0.187, 0.172, 0.157, 0.153, 0.153, 0.147, 0.127, 0.113, 0.111, 0.096, 0.096, 0.092, 0.083, 0.08, 0.075, 0.066, 0.059, 0.057, 0.055, 0.045, 0.037, 0.02, 0.018, 0.014, 0.011, 0.01, 0.007, 0.004, 0.004, 0.002, 0.002 | |
] | |
} |
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":"scaling builds","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} |
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 times = tributary.build_times.build_times; | |
var big_scale = d3.scale.linear() | |
.domain([1, 150]) | |
.range([10, 350]); | |
var scale = d3.scale.linear() | |
.domain([0.001, .1]) | |
.range([10, 350]); | |
var size = function(d) { | |
if(d < 0.1) | |
return d*1000 | |
return d*2 | |
}; | |
svg.selectAll('rect').data(times).enter().append("rect") | |
.attr("width", size) | |
.attr("height", size) | |
.attr("x", function(d) { | |
if(d < 0.1) | |
return d*8760 | |
if(d > 31) | |
return d*5.72 + -179 | |
return d*20 + 94 | |
}) | |
.attr("y", function(d){ | |
if(d < 0.1) | |
return d * 1183; | |
if(d > 31) | |
return d + 270; | |
return d*4 + 198; | |
}) | |
.attr("rx", 15) | |
.style("fill", function(d) { | |
if(d < 0.1) | |
return "rgb(0,0,"+Math.round(scale(d))+")"; | |
if(d < 30) | |
return "rgb("+Math.round(scale(d))+",0,0)"; | |
if(true) | |
return "rgb(0,"+Math.round(big_scale(d))+",0)"; | |
}) | |
.style("fill-opacity", 0.2736); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment