Learning to create a reusable chart function for a scatter plot, following Mike Bostock's "Towards Reusable Charts." Also includes a random data generator.
This file contains hidden or 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 width = 660, | |
height = 600; | |
var color = d3.scale.linear() | |
.domain([0, width/4, width/4 * 2, width/4 * 3, width]) | |
.range(["#fb000f", "#6e00fb", "#00fbec", "#8dfb00", "#fb3c00"]) | |
.interpolate(d3.interpolateHsl); | |
var svg = d3.select("#colorz").append("svg") | |
.attr("width", width) |