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

Dynamically changing the scope #178

Closed ziemke closed 8 years ago

ziemke commented 9 years ago

Hi,

is it possible to dynamically changing the scope of the map? I start with a world map. What I am trying to achieve is that the map automatically redraws itself after executing the following code:

 .on("click", function() {
    that.map.scope = "usa";
  })

I have found methods for updating bubbles, arcs, etc. but not for the scope.

Thank you very much in advance for your help!

markmarkoh commented 9 years ago

@ziemke

Currently that's not possible. Once the scope is set it can't be easily altered.

The closest you could get with DataMaps is writing some custom code to change the zoom/focus dynamically (like zoom in on USA, then zoom in on Europe).

But that would be at the world scope and wouldn't give you individual US states (since they are merged into 1 geography for the world scope)