markmarkoh / datamaps

Customizable SVG map visualizations for the web in a single Javascript file using D3.js
http://datamaps.github.io
MIT License
3.78k stars 1.01k forks source link

add lat and long lines? #30

Closed atmccann closed 10 years ago

atmccann commented 10 years ago

hey Mark,

DataMaps is awesome, thanks so much for building. Was looking to either add or bring back latitude and longitude lines that Mike Bostock usually includes with d3.geo http://bl.ocks.org/mbostock/3682698 -- was looking for a way to add them in datamaps.all.js but just kept breaking things. Is this an easy addition?

let me know, thanks!

markmarkoh commented 10 years ago

Would it work to do something like this?:

   var map = new Datamap({
        scope: 'world',
        element: document.getElementById('container1'),
        done: function(datamap) {
          var graticule = d3.geo.graticule();
          datamap.svg.append("path")
            .datum(graticule)
            .attr("class", "graticule")
            .attr("d", datamap.path);
        },
       geographyConfig: {...}
atmccann commented 10 years ago

yeah! except strangely the right-most longitude line doesn't render -- what gives? thanks for the quick fix though!

my code here: https://gist.github.com/atmccann/7161145

markmarkoh commented 10 years ago

No problem!

And I have no idea why the right-most line doesn't show up. Just took a look - strange!

I'm going to close this issue since for the most part it's solved - but if you figure out why the line doesn't appear please leave a comment for future reference!

markmarkoh commented 10 years ago

For that projection, it looks like Bostock just draws a sphere over the country to handle that issue

http://bl.ocks.org/mbostock/3682698 (if you remove the <use> tags, you should see the same issue you have.

atmccann commented 10 years ago

ha, good catch!

On Fri, Oct 25, 2013 at 5:15 PM, Mark DiMarco notifications@github.comwrote:

For that projection, it looks like Bostock just draws a sphere over the country to handle that issue

http://bl.ocks.org/mbostock/3682698 (if you remove the tags, you should see the same issue you have.

— Reply to this email directly or view it on GitHubhttps://github.com/markmarkoh/datamaps/issues/30#issuecomment-27126517 .

Allison McCann Graphics Editor, Businessweek 650.644.8381 www.allisontmccann.com