admin管理员组文章数量:1245088
I need to write a webpage which starts with a blank map of the US and colors the states according to data it receives from various Ajax requests. The map needs to change over time without the page reloading, and the user can click on various controls to instantly change how the map is colored. This all needs to be done locally, so I can't make use of Google maps or any similar internet service.
I'd hope to do this in the browser with Javascript. Is there a good library for doing this? Or any general suggestions for how to best implement this?
I need to write a webpage which starts with a blank map of the US and colors the states according to data it receives from various Ajax requests. The map needs to change over time without the page reloading, and the user can click on various controls to instantly change how the map is colored. This all needs to be done locally, so I can't make use of Google maps or any similar internet service.
I'd hope to do this in the browser with Javascript. Is there a good library for doing this? Or any general suggestions for how to best implement this?
Share Improve this question asked Apr 24, 2009 at 13:27 Eli CourtwrightEli Courtwright 193k68 gold badges223 silver badges257 bronze badges 2- 1 Can you use flash? This sounds like a great job for Flash. – Daniel A. White Commented Apr 24, 2009 at 13:29
- Unfortunately Flash isn't an option. It's possible that Java Applets might be permissible, but the client won't have Flash installed in many of their browsers, which makes it a non-starter. – Eli Courtwright Commented Apr 24, 2009 at 13:33
4 Answers
Reset to default 10I would take a plugin like this just change it to do "highlighting" based on your dynamic data:
http://plugins.jquery./project/maphilight
Demo of plugin: http://davidlynch/js/maphilight/docs/demo_usa.html
Currently it highlights on mouseover, but highlighting using data given should be very straightforward.
The fact it es with a map of the US and highlighting ready to go set is just gravy.
Sounds like a job for Raphaël
Here is example of pure JS, SVG/VML solution: http://jvectormap.owl-hollow/
You may still be able to use the Google Static Maps API's "path" parameter to overlay the color you want. Create some static maps and save the resulting image.
http://code.google./apis/maps/documentation/staticmaps/index.html#Paths
本文标签: Dynamically coloring a US map with JavascriptStack Overflow
版权声明:本文标题:Dynamically coloring a US map with Javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1740151452a2232734.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论