Advertisement
Guest User

Untitled

a guest
Apr 21st, 2014
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. var svg = d3.select("#canvas"),
  2. globe = svg.selectAll(".country"),
  3. sens = .25, //sensitivity
  4. circle,
  5. zoomed = false;
  6.  
  7. width = window.innerWidth;
  8. height = window.innerHeight;
  9.  
  10. svg
  11. .attr("width", width)
  12. .attr("height", height)
  13.  
  14. var projection = d3.geo.orthographic()
  15. .scale(300)
  16. .translate([width / 2, height /2 ])
  17. .rotate([0,0])
  18. .clipAngle(90)
  19. .precision(.1);
  20.  
  21.  
  22. var path = d3.geo.path()
  23. .projection(projection);
  24.  
  25.  
  26. d3.json("world.json", function(error, world) {
  27.  
  28. circle = svg.append("circle")
  29. .attr('cx', width / 2)
  30. .attr('cy', height / 2)
  31. .attr('r', projection.scale())
  32. .attr("stroke", "#aaaaaa")
  33. .attr("stroke-width", "1")
  34. .attr("fill", "white");
  35.  
  36.  
  37. countries = topojson.feature(world, world.objects.countries).features;
  38.  
  39. globe = globe.data(countries)
  40. .enter()
  41. .append("path")
  42. .attr("d", path)
  43. .attr("class", "country")
  44. .attr("id", function(d){return d.properties.id})
  45. .on("dblclick", zoomIn)
  46. .on("click", panTo)
  47. .append('title').text('This is a line.');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement