Javascript 使用setFocus更改jVectorMap中多个区域的缩放级别
我有多区域过滤功能的数据系列 我已在地图中启用了设置焦点,以便在过滤后能够将地图居中 似乎该比例仅适用于单个区域选择 过滤后是否可以将地图缩小2级 以下是一个示例数据集:Javascript 使用setFocus更改jVectorMap中多个区域的缩放级别,javascript,jvectormap,Javascript,Jvectormap,我有多区域过滤功能的数据系列 我已在地图中启用了设置焦点,以便在过滤后能够将地图居中 似乎该比例仅适用于单个区域选择 过滤后是否可以将地图缩小2级 以下是一个示例数据集: var codes = ['AU', 'AF', 'BD', 'IN']; 以下是我的地图设置: var map = new jvm.Map({ container: $('#jvectormap-wrapper'), backgroundColor: '#fff', zoomOnScroll: false,
var codes = ['AU', 'AF', 'BD', 'IN'];
以下是我的地图设置:
var map = new jvm.Map({
container: $('#jvectormap-wrapper'),
backgroundColor: '#fff',
zoomOnScroll: false,
series: {
regions: [{
values: codes,
normalizeFunction: 'polynomial'
}]
},
regionStyle: {
initial: {
fill: '#eee'
}
},
});
下面是筛选值的示例数据集
var filteredCodes = ['AU', 'AF'];
以下是我根据过滤值对地图居中的设置:
map.setFocus({
regions: filteredCodes
});
map.setScale(5);
似乎setScale不起作用并抛出错误:
jquery.jvectormap.min.js:1 Error: <g> attribute transform: Expected number, "scale(AU,AF...".
map.setFocus({
scale: 5,
lat: lat,
lng: lng,
});