Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :d3.select(window).on("resize", throttle);
- // Allow zooming
- var zoom = d3.behavior.zoom()
- // scaleExtent allows zooming from size of image (1) to (9) times magnification
- .scaleExtent([1, 9])
- .on("zoom", move);
- var width = document.getElementById('map').offsetWidth;
- var height = 400;
- var topo,projection,path,svg,g,b,s;
- var graticule = d3.geo.graticule();
- // Add tooltip to map with two classes: tooltip and hidden
- // Updates in draw function
- var tooltip = d3.select("#map").append("div").attr("class", "tooltip hidden");
- setup(width,height);
- function setup(width,height){
- // Create mercator-style map and center it on the page
- projection = d3.geo.equirectangular()
- .translate([(width/2), (height/1.5)])
- .scale( width / 3.4 / Math.PI);
- path = d3.geo.path().projection(projection);
- svg = d3.select("#map").append("svg")
- .attr("width", width)
- .attr("height", height)
- .call(zoom)
- .on("click", click)
- .append("g");
- g = svg.append("g");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement