Why drawing a map from google docs takes +50seconds, I have just two columns and 40 rows: Columns are CITY, NAME. some cities are duplicate. According to firebug, network connection takes just 2-3 secs. All cities are in 1 country, can I somehow optimize this?
My code is:
google.load('visualization', '1',
{'packages': ['table', 'map']});
google.setOnLoadCallback开发者_运维问答(initialize);
function initialize() {
// The URL here is the URL of the spreadsheet.
// This is where the data is.
var query = new google.visualization.Query(
'http://spreadsheets.google.com/tq?key=xx');
query.send(draw);
}
function draw(response) {
if (response.isError()) {
alert('Error in query');
}
var geoView = new google.visualization.DataView(response.getDataTable());
//geoView.setColumns([0, 1,2]);
var table =
new google.visualization.Table(document.getElementById('table_div'));
table.draw(response.getDataTable(), {showRowNumber: false});
var map =
new google.visualization.Map(document.getElementById('map_div'));
map.draw(geoView, {showTip: true});
Your code is pretty simple and I can't see anything that would slow it down. In my application I am using several visualizations, including the table view and the map, displaying 77 rows. It takes approximately 7-15 seconds. It might just be your connection or domain.
精彩评论