jVectorMap标记和地图

时间:2013-12-13 17:24:01

标签: jquery jvectormap

是否可以使用带有标记的不同地图然后是白色地图?

http://jvectormap.com/examples/markers-world/

到目前为止,我只能使用白色地图,但我想使用蓝色地图。

$(function(){
  $('#world-map-markers').vectorMap({
    map: 'world_mill_en',
    scaleColors: ['#C8EEFF', '#0071A4'],
    normalizeFunction: 'polynomial',
    hoverOpacity: 0.7,
    hoverColor: false,
    markerStyle: {
      initial: {
        fill: '#F8E23B',
        stroke: '#383f47'
      }
    },
    backgroundColor: '#383f47',
    markers: [      
      {latLng: [0.33, 6.73], name: 'São Tomé and Príncipe'}
    ]
  });
});

1 个答案:

答案 0 :(得分:1)

是的,当然!初始化jVectorMap时需要传递regionStyle对象。

regionStyle: {
    initial: {
        fill: 'blue',
        "fill-opacity": 1,
        stroke: 'none',
        "stroke-width": 0,
        "stroke-opacity": 1
    },
    hover: { // other style when hovering a region
        "fill-opacity": 0.8
    },
    selected: { // other style when a region is selected
        fill: 'yellow'
    },
    selectedHover: {} // other styles when hovering a selected region
},

以下是蓝色地图的示例:http://jsfiddle.net/9Vyv6/2/