我想专注于美国州的选择。代码是这样的:
var ddd = {
"US-VA": 1,
"US-PA": 1,
"US-TX": 1,
"US-RI": 1,
"US-SC": 1,
"US-OR": 1,
"US-CO": 1,
"US-KY": 1
};
var map = {};
$(function(){
map = new jvm.WorldMap({
map: 'us_aea_en',
backgroundColor: '#EEEEEE',
container: $('#us-map'),
regionsSelectable: true,
regionsSelectableOne: true,
regionStyle: {
initial: {
fill: '#777777',
"fill-opacity": 1,
stroke: 'none',
"stroke-width": 0,
"stroke-opacity": 1
}
},
series: {
regions: [{
values: ddd,
scale: ['#FF6633', '#FF6622'],
normalizeFunction: 'linear'
}]
},
markerStyle: {
initial: {
fill: '#F8E23B',
stroke: '#383f47'
}
},
markers: [
{latLng: [41.17, -74.92], name: 'New York'},
{latLng: [34.06, -118.25], name: 'Los Angeles'},
{latLng: [29.98, -95.54], name: 'Houston'},
{latLng: [42.42, -71.3], name: 'Boston'},
{latLng: [32.79, -96.81], name: 'Dallas'},
{latLng: [32.79, -79.95], name: 'Charleston'},
{latLng: [38.02, -122.89], name: 'San Francisco'},
{latLng: [35.17, -106.86], name: 'Albuquerque'},
{latLng: [35.72, -97.99], name: 'Oklahoma City'},
{latLng: [61.22, -149.91], name: 'Anchorage'},
{latLng: [21.47, -158.08], name: 'Honolulu'}
],
//onRegionSelected: function(event, isSelected, selectedRegions){
onRegionSelected: function(selectedRegions){
map.setFocus(9, selectedRegions);
}
});
});
当我选择一个区域时,标记被绘制在错误的位置。可以看到一个小的变化,就像地图尝试那样setFocus
,但标记位于左上角。我使用jvectormap-1.1.1.min.js和jquery-1.8.3.min.js
这是加载时的地图:
这是选择状态后的地图:
有什么线索吗?