为什么从谷歌文档绘制地图需要+50秒
为什么从谷歌文档绘制地图需要+50秒,我只有两列和 40 行: 列是城市、名称。有些城市是重复的。根据 firebug 的说法,网络连接只需 2-3 秒。所有城市都在 1 个国家/地区,我可以以某种方式对此进行优化吗?
我的代码是:
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});
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});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的代码非常简单,我看不出任何会减慢速度的内容。在我的应用程序中,我使用了多种可视化效果,包括表格视图和地图,显示 77 行。大约需要 7-15 秒。它可能只是您的连接或域。
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.