Create a scale key for jvectormap region colors

2019-08-10 01: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:

enter image description here

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?

标签: jvectormap
1条回答
再贱就再见
2楼-- · 2019-08-10 02:16

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);
查看更多
登录 后发表回答