所以我有一个地图,它显示并且目前有除波多黎各以外的所有可用的州数据。即使当我动态加载数据和波多黎各不是数据集的一部分,它仍然允许我悬停在气球文本。我想让整个波多黎各都瘫痪。这是我的地图脚本:
function initializeFoodSafetyMap() {
var mapData = $('#foodSafetyMap').data('url');
var newmapdata = [];
var mapHeader = ['map-hdr-us'];
$.ajax({
url: mapData,
cache: false,
type: 'GET',
dataType: 'json',
contentType: "application/json; charset=utf-8",
success: function (data) {
$.each(data, function (index, item) {
if (item.CategoryAmount > 0) {
newmapdata.push({
id: "US-" + item.GeoCode,
title: item.Category,
value: item.CategoryAmount,
balloonText: "<b>" + item.GeoName +
"</b>" + "<br>$" + item.CategoryAmount.toLocaleString(),
info: 'TEST',
color: "#91B2AB"
});
}
});
var map = AmCharts.makeChart("foodSafetyMap", {
type: "map",
"theme": "light",
dragMap: true,
fixedSize: false,
colorSteps: 10,
"responsive": {
"enabled": true,
// Rules
"rules": [
// at 500px wide, we hide baloons
{
"maxWidth": 500,
"overrides": {
"balloon": {
"enabled": false
},
"imagesSettings": {
"labelPosition": "middle",
"labelFontSize": 8
}
}
}
]
},
// End of Rules
"areasSettings": {
"autozoom": true,
outlineColor: "#000000"
},
dataProvider: {
map: "usaLow",
areas: newmapdata,
getAreasFromMap: true,
images: [
{
label: "AL",
latitude: -40,
longitude: 81,
linkToObject: "US-AL"
}, {
label: "AK",
latitude: -84,
longitude: -130,
linkToObject: "US-AK"
}, {
label: "AZ",
latitude: -4,
longitude: -85,
linkToObject: "US-AZ"
}, {
label: "AR",
latitude: -11,
longitude: 41,
linkToObject: "US-AR"
}, {
label: "CA",
latitude: 70,
longitude: -135,
linkToObject: "US-CA"
}, {
label: "CO",
latitude: 60,
longitude: -42,
linkToObject: "US-CO"
}, {
"label": "CT",
"latitude": 71,
"longitude": 180,
"linkToObject": "US-CT",
//labelBackgroundColor: "#cccccc",
labelBackgroundAlpha: .8
}, {
label: "DE",
//labelBackgroundColor: "#cccccc",
latitude: 38,
longitude: 180,
linkToObject: "US-DE",
labelBackgroundAlpha: .8
}, {
//labelBackgroundColor: "#cccccc",
label: "DC",
latitude: -20,
longitude: 180,
linkToObject: "US-DC",
labelBackgroundAlpha: .8
}, {
label: "FL",
latitude: -78,
longitude: 120,
linkToObject: "US-FL"
}, {
label: "GA",
latitude: -40,
longitude: 102,
linkToObject: "US-GA"
}, {
label: "HI",
latitude: -88.7,
longitude: -35.7,
linkToObject: "US-HI"
},
{
label: "PR",
latitude: -88.9,
longitude: 22.9,
linkToObject: "US-PR"
},
{
label: "ID",
latitude: 85,
longitude: -85,
linkToObject: "US-ID"
}, {
label: "IL",
latitude: 65,
longitude: 60,
linkToObject: "US-IL"
}, {
label: "IN",
latitude: 67,
longitude: 78,
linkToObject: "US-IN"
}, {
label: "IA",
latitude: 77,
longitude: 35,
linkToObject: "US-IA"
}, {
label: "KS",
latitude: 48,
longitude: 5,
linkToObject: "US-KS"
}, {
label: "KY",
latitude: 42,
longitude: 87,
linkToObject: "US-KY"
}, {
label: "LA",
latitude: -65,
longitude: 43,
linkToObject: "US-LA"
}, {
label: "ME",
latitude: 88.3,
longitude: 168,
linkToObject: "US-ME"
}, {
label: "MD",
//labelBackgroundColor: "#cccccc",
latitude: 10,
longitude: 180,
linkToObject: "US-MD",
labelBackgroundAlpha: .8
}, {
label: "MA",
latitude: 83.5,
longitude: 180,
linkToObject: "US-MA",
labelBackgroundAlpha: .8,
//labelBackgroundColor: "#cccccc",
}, {
label: "MI",
latitude: 82.7,
longitude: 85,
linkToObject: "US-MI"
}, {
label: "MO",
latitude: 48,
longitude: 40,
linkToObject: "US-MO"
}, {
label: "MN",
latitude: 87,
longitude: 28,
linkToObject: "US-MN"
}, {
label: "MS",
latitude: -40,
longitude: 61,
linkToObject: "US-MS"
}, {
label: "MT",
latitude: 88.2,
longitude: -55,
linkToObject: "US-MT"
}, {
label: "NE",
latitude: 75,
longitude: 0,
linkToObject: "US-NE"
}, {
label: "NV",
latitude: 75,
longitude: -107,
linkToObject: "US-NV"
}, {
label: "NH",
//labelBackgroundColor: "#cccccc",
latitude: 86.2,
longitude: 180,
linkToObject: "US-NH",
labelBackgroundAlpha: .8
}, {
label: "NJ",
//labelBackgroundColor: "#cccccc",
latitude: 58,
longitude: 180,
linkToObject: "US-NJ",
labelBackgroundAlpha: .8
}, {
label: "NM",
latitude: -10,
longitude: -46,
linkToObject: "US-NM"
}, {
label: "NY",
latitude: 85,
longitude: 140,
linkToObject: "US-NY"
}, {
label: "NC",
latitude: 23,
longitude: 128,
linkToObject: "US-NC"
}, {
label: "ND",
latitude: 88,
longitude: -5,
linkToObject: "US-ND"
}, {
label: "OH",
latitude: 70,
longitude: 98,
linkToObject: "US-OH"
}, {
label: "OK",
latitude: -6,
longitude: 11,
linkToObject: "US-OK"
}, {
label: "OR",
latitude: 87,
longitude: -122,
linkToObject: "US-OR"
}, {
label: "PA",
latitude: 78,
longitude: 128,
linkToObject: "US-PA"
}, {
label: "RI",
//labelBackgroundColor: "#cccccc",
latitude: 79,
longitude: 180,
linkToObject: "US-RI",
labelBackgroundAlpha: .8
}, {
label: "SC",
latitude: -12,
longitude: 117,
linkToObject: "US-SC"
}, {
label: "SD",
latitude: 84.5,
longitude: -5,
linkToObject: "US-SD"
}, {
label: "TN",
latitude: 12,
longitude: 83,
linkToObject: "US-TN"
}, {
label: "TX",
latitude: -65,
longitude: 0,
linkToObject: "US-TX"
}, {
label: "UT",
latitude: 66,
longitude: -77,
linkToObject: "US-UT"
}, {
label: "VT",
latitude: 87,
longitude: 150.5,
linkToObject: "US-VT"
}, {
label: "VA",
latitude: 55,
longitude: 128,
linkToObject: "US-VA"
}, {
label: "WA",
latitude: 89,
longitude: -112,
linkToObject: "US-WA"
}, {
label: "WV",
latitude: 60,
longitude: 112,
linkToObject: "US-WV"
}, {
label: "WI",
latitude: 85,
longitude: 53,
linkToObject: "US-WI"
}, {
label: "WY",
latitude: 82.5,
longitude: -47,
linkToObject: "US-WY"
}
],
lines: [
{
//DC LINE
latitudes: [66.8921, -20],
longitudes: [135.6241, 173]
}, {
//CT LINE
latitudes: [82.8921, 71],
longitudes: [153.8241, 173]
}, {
//DE LINE
latitudes: [69.0921, 38],
longitudes: [145.2241, 173]
}, {
//MD LINE
latitudes: [69.8921, 10],
longitudes: [136.8241, 172.5]
}, {
//MA LINE
latitudes: [84.0921, 83],
longitudes: [153.8241, 173]
}, {
//NH LINE
latitudes: [86.0921, 86.2],
longitudes: [156.8241, 173]
}, {
//NJ LINE
latitudes: [76.0921, 58],
longitudes: [147.8241, 173]
}, {
//RI LINE
latitudes: [83.0921, 78],
longitudes: [162.8241, 173.5]
}
]
},
zoomControl: {
zoomControlEnabled: true,
panControlEnabled: false
},
"imagesSettings": {
"labelPosition": "middle",
"labelFontSize": 11
},
"listeners": [{
"event": "clickMapObject",
"method": function (event) {
document.getElementById("info").innerHTML = '<hr><p><b>' + event.mapObject.title + '</b></p><p>' + event.mapObject.info + '</p>';
}
}]
});
}
});
}
我想明白了,我必须删除
getAreasFromMap: true,