我正在使用 jquery 和这个插件。这是我目前拥有的(底部的实际问题):
到目前为止,我有以下代码:
var properties = [];
jQuery.each(json['properties'],function(k,v){
properties.push({
name:v.name,
status:v.status,
color:v.color,
size:v.size,
price:v.price
});
});
console.log(properties);
对于 getJson 它返回:
{
"land": {
"Long Land": {
"path": "M541.421,195.072 156.67,423.574 7.16,321.971 428.509,14.837 639.505,78.824 715.519,62.551 696.101,102.448 484.892,100.685 238.629,265.688 298.41,338.024 540.763,194.308 526.509,170.217 747.15,108.014 780.865,164.098 611.146,314.125",
"name": "Long Land"
}
},
"properties": {
"unit 1": {
"path": "M541.421,195.072 156.67,423.574 428.509,14.837 639.505",
"name": "unit 1",
"status": "Available",
"color": "#244df0",
"size": "3200",
"price": "300 000"
}
}
}
然后对于 console.log(properties) 我得到一个具有以下内容的对象:
color "#244df0"
name "unit 1"
price "300 000"
size "3200"
status "Available"
然后我初始化jvectormap:
//START JVECTORMAP
jQuery('#twinvalley-map').vectorMap({
map: 'twin_valley',
normalizeFunction: 'polynomial',
backgroundColor: false,
onRegionClick:function (event, code, region){
console.log(code);
}
});
//START JVECTORMAP
然后最后对于 onRegionClick console.log() 我得到了与以前的两个日志相同的名称.. 'unit 1'。
所以现在我的问题是,我将如何获得有关区域点击的其余数据?通过数据我的意思是:
color "#244df0"
name "unit 1"
price "300 000"
size "3200"
status "Available"
非常感谢任何帮助。