我们希望在Google Geochart上绘制大量(可能多达100或200)个标记。在绘制标记时,图表似乎会在一段时间内绘制这些标记,我们认为这对用户来说需要太长时间。我们希望立即或至少更快地显示它们。
我似乎没有找到任何文件来表明这是可配置的,所以有没有办法加快这一点?
我在下面添加了示例代码来复制它,可以在visualization playground中运行。
function drawVisualization() {
var data = google.visualization.arrayToDataTable([
['City', 'Count'],
['London',245],
['Manchester',58],
['Birmingham',54],
['Stoke-on-trent',30],
['Leicester',26],
['Liverpool',25],
['Nottingham',19],
['Preston',18],
['Glasgow',15],
['Leeds',14],
['West Bromwich',13],
['Sheffield',11],
['Cardiff',8],
['Wigan',8],
['Wolverhampton',8],
['Bolton',7],
['Bradford',7],
['Edinburgh',7],
['Telford',7],
['Warrington',7],
['Romford',6],
['Stockport',6],
['Swansea',6],
['Burnley',5],
['Coventry',5],
['Dagenham',5],
['Ipswich',5],
['Milton Keynes',5],
['Newcastle Upon Tyne',5],
['Northampton',5],
['Birkenhead',4],
['Blackburn',4],
['Burton-on-trent',4],
['Croydon',4],
['Durham',4],
['Reading',4],
['Rotherham',4],
['Saint Helens',4],
['Stafford',4],
['Stevenage',4],
['Sunderland',4],
['Accrington',3],
['Ashford',3],
['Bangor',3],
['Barrow',3],
['Blackpool',3],
['Bristol',3],
['Bury',3],
['Cambridge',3],
['Chesterfield',3],
['Chorley',3],
['Dundee',3],
['Heywood',3],
['Ilford',3],
['Lancaster',3],
['Luton',3],
['Mansfield',3],
['Newport',3],
['Oldbury',3],
['Oldham',3],
['Plymouth',3],
['Sale',3],
['Slough',3],
['Southend-on-sea',3],
['Stratford-upon-avon',3],
['Aylesbury',2],
['Bedford',2],
['Brighton',2],
['Caerphilly',2],
['Cannock',2],
['Canterbury',2],
['Carshalton',2],
['Chatham',2],
['Chelmsford',2],
['Cheltenham',2],
['Chester',2],
['Corby',2],
['Crawley',2],
['Crumlin',2],
['Cwmbran',2],
['Exeter',2],
['Folkestone',2],
['Gravesend',2],
['Guildford',2],
['Halesowen',2],
['Harrow',2],
['Huddersfield',2],
['Isleworth',2],
['Lichfield',2],
['Lincoln',2],
['Mitcham',2],
['Oxford',2],
['Peterborough',2],
['Rawtenstall',2],
['Rochdale',2],
['Scunthorpe',2],
['Solihull',2],
['South Shields',2]
]);
var geochart = new google.visualization.GeoChart(
document.getElementById('visualization'));
geochart.draw(data, {width: 556, height: 347, region: 'GB', displayMode: 'markers', legend:'none'});
}
答案 0 :(得分:4)
这是因为Google将您的位置转换为经度/纬度的速度非常慢;你应该一劳永逸地解决它们并直接使用它们(Markers mode format)。
答案 1 :(得分:3)
以下是有关如何使用lat / long并放置信息工具提示的示例:
http://jsfiddle.net/cmoreira/njB6m/
data.addColumn('number', 'Lat');
data.addColumn('number', 'Long');
data.addColumn('string','tooltip');
data.addColumn('number','Example');
data.addRows([[41.151636,-8.569336,'Portugal',{v:0,f:'test PT'}]]);
data.addRows([[ 39.059575,-98.789062,'USA',{v:1,f:'test US'}]]);