Create a scale key for jvectormap region colors

﹥>﹥吖頭↗ 提交于 2019-12-24 10:26:57

问题


I'd like to create a key to my map that shows the values associated with the different colors, as at the bottom of the drawing:

I can make a series of boxes easily enough. Is there a method somewhere I can input a value to get the color back that the map would use for that value?


回答1:


First you need a map object. If you have created a map with jvm.WorldMap constructor you have it already, otherwise if you have created a map using jQuery wrapper you can do:

var map = $('#map').vectorMap('get', 'mapObject');

Then to convert the value to color do the following:

var color = map.series.regions[0].scale.getValue(someValue);


来源:https://stackoverflow.com/questions/13147104/create-a-scale-key-for-jvectormap-region-colors

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!