Built with blockbuilder.org
This is being generated as a study from the Ian Johnson dot Enter tutorial series.
xxxxxxxxxx
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v3.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
</style>
</head>
<body>
<script>
// Feel free to change or delete any of the code you see in this editor!
var svg = d3.select("body").append("svg")
.attr("width", 960)
.attr("height", 500)
var data1 = d3.range(10)
var colorScale = d3.scale.category20c()
var colorScale1 = d3.scale.ordinal()
.range(["#ff0000",
"#00ff00",
"#0000ff",
"#e3e3e3",
"#831031",
"#f5c54b"])
var colorScale2 = d3.scale.linear()
.domain([0, 10])
.range(["#ff0000","#fff600", "#00ff00"])
var rects = svg.selectAll("rect")
.data(data1);
rects.enter()
.append("rect")
.attr({
width: 10,
height: 100,
y:80,
x: function(d, i) {
return i *50 + 50;
},
fill: function(d, i){
return colorScale1(i);
}
})
</script>
</body>
https://d3js.org/d3.v3.min.js