neveldo / jQuery-Mapael

jQuery plugin based on raphael.js that allows you to display dynamic vector maps
https://www.vincentbroute.fr/mapael/
MIT License
1.01k stars 195 forks source link

Question on placing dots within a mapael object #286

Closed nevkatz closed 7 years ago

nevkatz commented 7 years ago

Hello,

I am interested in creating a map of the US in which individual states each have districts marked by pins or circles. On hover (or on click), an individual state would enlarge, and the districts (as well as the distance between them) would enlarge proportionally (since they are part of that state). I gather that this is possible, but I am also wondering whether the mapael API allows you to place dots within a state so that they enlarge as well when the state enlarges.

(One approach I was thinking of would be to treat each state as an individual map with its own "districts" layer, so that the districts enlarge when the state does.)

I will plan to read more about the API, and in the meantime, any insight you could provide would be terrific. Thanks!

Nevin

neveldo commented 7 years ago

Hello @nevkatz ,

Sorry for my late answer. You are right regarding the first approach that you suggest, I think it will work fine, but you will have to create the individual maps for all the states.

What do you think about this approach, in which the map is zoomed when the user click on an area ? (in this example, the cities are only shown on click, because there is too many cities to show at once) ? Feel free to chek the source code !

nevkatz commented 7 years ago

Understood. I do like that new approach you link to and I might run it by the client. Their initial spec called for states that enlarge on hover, but this looks like a good alternative that they may not have thought of. Many thanks!

neveldo commented 7 years ago

I'm glad it helped you. I think the previous example is pretty self-explanatory, but feel free to ask if you need some help for implementing it !