Guest User

Untitled

a guest
Apr 26th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. var path = d3.geo.path();
  2. //Defaults to albersUsa Projection. You might want to set a different one
  3. var width = 960, height = 600;
  4. //Create the svg to render the polygon inside of
  5. var svg = d3.select("body").append("svg")
  6. .attr("width", width)
  7. .attr("height", height);
  8. //Bind the geoJSON the path elements in the svg
  9. //Use the enter selection (new elements) and draw the paths using the geo path generator
  10. svg.selectAll("path")
  11. .data(geoJSON.features)
  12. .enter().append("path")
  13. .attr("d",path)
  14. .attr("fill",#999);
  15. //Note that when you bind new data, you will be changing existing path elements
  16. //So you would also need to do a exit and modify existing paths
Add Comment
Please, Sign In to add comment