google.charts.load('current', {'packages':['geochart']});
google.charts.setOnLoadCallback(drawRegionsMap);
function drawRegionsMap() {
var query = new google['visualization'].Query('https://docs.google.com/spreadsheets/d/____&headers=1&range=A1:B')
query.send(handleQueryResponseTR);
}
function handleQueryResponseTR(response) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
return;
}
var options = {
region: 'world',
displayMode: 'markers',
sizeAxis: { minValue: 0, maxValue: 5 },
colorAxis: {
colors: ['#fff', '#000']
},
legend: 'none'
};
var data = response.getDataTable();
var chart = new google.visualization.GeoChart(document.getElementById('geochart-colors'));
chart.draw(data, options);
};
The spreadsheet has the format:
Country Value
XX XX
XX XX
There are approximately 40 entries (40 different countries). Everything works, but the map loads the markers one by one and it takes about 30 seconds to load all of them. Why is it so slow? It's not the fact that it's loading them from a Google Sheets, even when hard coded the load time is the same.