Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. :d3.select(window).on("resize", throttle);
  2.  
  3. // Allow zooming
  4. var zoom = d3.behavior.zoom()
  5. // scaleExtent allows zooming from size of image (1) to (9) times magnification
  6. .scaleExtent([1, 9])
  7. .on("zoom", move);
  8.  
  9.  
  10. var width = document.getElementById('map').offsetWidth;
  11. var height = 400;
  12.  
  13. var topo,projection,path,svg,g,b,s;
  14.  
  15. var graticule = d3.geo.graticule();
  16.  
  17. // Add tooltip to map with two classes: tooltip and hidden
  18. // Updates in draw function
  19. var tooltip = d3.select("#map").append("div").attr("class", "tooltip hidden");
  20.  
  21. setup(width,height);
  22.  
  23. function setup(width,height){
  24. // Create mercator-style map and center it on the page
  25. projection = d3.geo.equirectangular()
  26. .translate([(width/2), (height/1.5)])
  27. .scale( width / 3.4 / Math.PI);
  28.  
  29. path = d3.geo.path().projection(projection);
  30.  
  31. svg = d3.select("#map").append("svg")
  32. .attr("width", width)
  33. .attr("height", height)
  34. .call(zoom)
  35. .on("click", click)
  36. .append("g");
  37.  
  38.  
  39. g = svg.append("g");
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement