diff --git a/examples/mapping/app.js b/examples/mapping/app.js index f787508..94ce4b4 100644 --- a/examples/mapping/app.js +++ b/examples/mapping/app.js @@ -1,19 +1,21 @@ var width = 960; var height = 490; +//set the height/width of the svg d3.select('svg') .attr('width', width) .attr('height', height); +//choose a project that works with our data var worldProjection = d3.geoEquirectangular(); -d3.select('svg').selectAll('path') - .data(map_json.features) - .enter() - .append('path') - .attr('fill', '#099'); +d3.select('svg').selectAll('path') //select all path elements within the svg, even if none exist + .data(map_json.features) //link the features array of our data to that selection + .enter() //find the data elements not associated with paths + .append('path') //append a path for each unmatch data element + .attr('fill', '#099'); //set the fill for all paths -var dAttributeFunction = d3.geoPath() +var dAttributeFunction = d3.geoPath() //create a path drawing function that will use our worldProjection .projection(worldProjection); -d3.selectAll('path').attr('d', dAttributeFunction); +d3.selectAll('path').attr('d', dAttributeFunction); //use that function to modify the d attribute of all path elements diff --git a/examples/mapping/index.html b/examples/mapping/index.html index 1d256ad..393720f 100644 --- a/examples/mapping/index.html +++ b/examples/mapping/index.html @@ -4,6 +4,7 @@ +