Skip to content

Instantly share code, notes, and snippets.

@makoto
Forked from anonymous/_.md
Created October 3, 2012 07:56
Show Gist options
  • Save makoto/3825695 to your computer and use it in GitHub Desktop.
Save makoto/3825695 to your computer and use it in GitHub Desktop.
just another inlet to tributary
{"editor_editor":{"coffee":false,"vim":false,"emacs":false,"width":528,"height":570,"hide":false},"endpoint":"tributary","public":true}
var svg = d3.select("svg");
var data1 = d3.range(38);
var rects = svg.selectAll("rect")
.data(data1);
//var colorScale = d3.scale.category20();
/*
var colorScale = d3.scale.ordinal()
.range(["#540069",
"#0033FF",
"#00C2FF",
"#831010"
]);
*/
var colorScale = d3.scale.linear()
.domain([d3.min(data1), d3.max(data1)])
//.interpolate(d3.interpolateHsl)
//.interpolate(d3.interpolateLab)
.interpolate(d3.interpolateHcl)
.range(["#007AFF", "#FFF500"]);
rects.enter()
.append("rect")
.attr({
width: 12,
height: 100,
y: 100,
x: function(d,i) {
return i * 13 + 115;
},
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