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

Create multiple maps with datamaps side by side in div - only last legend remains #147

Closed nybiGit closed 8 years ago

nybiGit commented 9 years ago

Hi,

I successfully used the updateChoropleth function to animate my data, and now I am trying to have the user click on a link and show all the maps side by side so that they can view individual maps.

The first problem is that the code only allows from one div (e.g., "container"), and I can't figure out to create multiple divs in the code. So what I do is that I create the different divs in the body and then call them one by one. The problem now, however, is that because the legend does not get placed in the "container1" div, it is simply hidden by the second map in "container2". Is there a way to fix this?

I would be ok with having only one legend at the bottom of the page, but I would still need a title for all my maps, and my titles are also in the legend.

Any thoughts how to fix this?

Thank you,

Nybi

nybiGit commented 9 years ago

Ok, I actually fixed the problem. I had added a "d3.select(".datamaps-legend").remove();" which erases the legend for an animation with the same data. Now, I simply removed it and it works.