Jquery Jvectormap在标记内添加文本

Jquery Jvectormap在标记内添加文本,jquery,ruby-on-rails-3,map,jvectormap,Jquery,Ruby On Rails 3,Map,Jvectormap,我正在使用最新的Jvectormap(1.2.2),但找不到在标记中添加文本的示例。 我想在标记内显示各个国家的计数 下面是我为显示标记而编写的代码 $ -> $('#world-map').vectorMap map: "world_mill_en" scaleColors: ["#C8EEFF", "#0071A4"] backgroundColor: 'white' regionStyle: initial: fill:

我正在使用最新的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")
Im当前正在控制器中生成标记数据,并将其存储在隐藏字段中,然后传递给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}]
我能够在屏幕上得到标记,我只是想在这些标记中添加计数值

$ ->
  $('#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")

提前感谢所有花时间阅读的人。

使用
onMarkerLabelShow


这里还有另一个相关的SO问题:

在MarkerLabelShow上使用


这是另一个相关的SO问题:

onMarkerLabelShow将在标签上显示文本,而我需要它位于标记上它自己onMarkerLabelShow将在标签上显示文本,而我需要它位于标记本身上