Setting up Google Geomap visualization for Italy regions
I'm trying to set up a geomap visualization for Italy's regions, but if I use regions, ins开发者_运维技巧tead of markers for my dataMode option it doesn't work. I'm obviously just beginning to learn how to use this API, thank you in advance.
function drawVisualization() {
var data = new google.visualization.DataTable();
data.addRows(2);
data.addColumn('string', 'Region');
data.addColumn('number', 'Popularity');
data.setValue(0, 0, 'Tuscany');
data.setValue(0, 1, 200);
data.setValue(1, 0, 'Verona');
data.setValue(1, 1, 300);
var options = {};
options['region'] = 'IT';
options['colors'] = [0xFF0000, 0xc06000];
options['dataMode'] = 'markers';
var geomap = new google.visualization.GeoMap(
document.getElementById('visualization'));
geomap.draw(data, options);
}
function drawMap() {
var data = new google.visualization.DataTable();
data.addRows(6);
data.addColumn('string', 'Country');
data.addColumn('number', 'Popularity');
data.setValue(0, 0, 'Lombardia');
data.setValue(0, 1, 200);
data.setValue(1, 0, 'Campania');
data.setValue(1, 1, 300);
data.setValue(2, 0, 'Lazio');
data.setValue(2, 1, 400);
data.setValue(3, 0, 'Toscana');
data.setValue(3, 1, 500);
data.setValue(4, 0, 'Sicilia');
data.setValue(4, 1, 600);
data.setValue(5, 0, 'Veneto');
data.setValue(5, 1, 700);
var options = {};
options['dataMode'] = 'regions';
options['region'] = 'IT';
var container = document.getElementById('map_canvas');
var geomap = new google.visualization.GeoMap(container);
geomap.draw(data, options);
};
精彩评论