D3 file structure
File structure
This needs to be fixed up, it’s just a placeholder for now.
// Set up your svg
var margin = {top: 20, right: 20, bottom: 30, left: 40},
width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
// Set up your scales
// Read in your data
queue()
.defer(d3.csv, "../data-file.csv")
.await(ready);
//
function ready(error, data) {
// set up any more scale work
// bind/append/etc your data
d3.select("#button").on("click", function(d) {
// change things on click
});
}