我无法为我的 Google Visualization Geomap 启用缩小选项。我正在尝试在用户单击某个区域时启用它。这是我的代码:
google.load('visualization', '1', {packages: ['geochart']});
var width, height, selectedRegion, resolution;
window.onload = function(){
width = 556;
height = 400;
selectedRegion = 'world';
resolution = 'subcontinents';
};
function drawVisualization() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Region');
data.addColumn('number', 'Distributors');
data.addRows([
[{v:"005", f:"South America"}, 0],
[{v:"011", f:"Western Africa"}, 46],
[{v:"013", f:"Central America"}, 299],
[{v:"014", f:"Eastern Africa"}, 63.9],
[{v:"015", f:"Northern Africa"}, 255.7],
[{v:"017", f:"Middle Africa"}, 21.4],
[{v:"018", f:"Southern Africa"}, 244.5],
[{v:"029", f:"Caribbean"}, 76.5],
[{v:"030", f:"Eastern Asia"}, 5712.9],
[{v:"034", f:"Southern Asia"}, 1275.1],
[{v:"035", f:"South-Eastern Asia"}, 639.2],
[{v:"039", f:"Southern Europe"}, 777.8],
[{v:"053", f:"Australia and New Zealand"}, 272],
[{v:"054", f:"Melanesia"}, 6.3],
[{v:"057", f:"Micronesia"}, 0],
[{v:"061", f:"Polynesia"}, 0],
[{v:"143", f:"Central Asia"}, 0],
[{v:"145", f:"Western Asia"}, 0],
[{v:"150", f:"Europe"}, 0],
[{v:"151", f:"Eastern Europe"}, 0],
[{v:"154", f:"Northern Europe"}, 0],
[{v:"155", f:"Western Europe"}, 0]
]);
var options = {
displayMode: 'regions',
enableRegionInteractivity: 'true',
resolution: resolution,
region: selectedRegion,
height: height,
width: width
};
var geochart = new google.visualization.GeoChart(document.getElementById('visualization'));
google.visualization.events.addListener(geochart, 'regionClick', function(e) {
var clickedRegion = e['region'];
options.region = clickedRegion;
options.resolution = "country";
options.showZoomOut = true;
geochart.draw(data, options);
});
geochart.draw(data, options);
}
google.setOnLoadCallback(drawVisualization);
有人可以告诉我我做错了什么吗?缩小按钮不显示..