【发布时间】:2016-11-27 12:34:37
【问题描述】:
我正在使用最新的 Jvectormap (1.2.2),但找不到任何在标记内添加文本的示例。 我想在各个国家/地区的标记内显示计数。
以下是我为显示标记而编写的代码。
$ ->
$('#world-map').vectorMap
map: "world_mill_en"
scaleColors: ["#C8EEFF", "#0071A4"]
backgroundColor: 'white'
regionStyle:
initial:
fill: "#D4D4D4"
markerStyle:
initial:
fill: "rgb(202,219,42)"
stroke: "#383f47"
markers: $("input#map_marker").data("values")
我当前在控制器中生成标记数据并将其存储在我传递给 jvectormap 的隐藏字段中。
数据如下
[{"name":"Algeria","latLng":[27.2257,2.49295],"weburl":"/en/browse?country_ids=1","count":45,"id":1},
{"name":"Angola","latLng":[-11.2027,17.8739],"weburl":"/en/browse?country_ids=2","count":46,"id":2},
{"name":"Benin","latLng":[9.30769,2.31583],"weburl":"/en/browse?country_ids=3","count":43,"id":3},
{"name":"Botswana","latLng":[-22.3285,24.6849],"weburl":"/en/browse?country_ids=4","count":42,"id":4}]
我能够在屏幕上获取标记,我只是想在这些标记中添加计数值。
提前感谢花时间阅读的任何人。
【问题讨论】:
标签: jquery ruby-on-rails-3 map jvectormap