Skip to content

Instantly share code, notes, and snippets.

@sangheestyle
Created December 4, 2013 05:58
Show Gist options
  • Save sangheestyle/7783040 to your computer and use it in GitHub Desktop.
Save sangheestyle/7783040 to your computer and use it in GitHub Desktop.
'moto x' 키워드로 해서 지난 6주간 트위터에서 트윗을 받아서 트윗한 사람의 location 을 알아내서 구글 차트 툴스의 geomap 에 맵핑한 것. 로딩하는데 시간이 좀 걸리는게 흠. (20초까지도 걸림)
<html>
<head>
<script type='text/javascript' src='https://www.google.com/jsapi'></script>
<script type='text/javascript'>
google.load('visualization', '1', {'packages': ['geomap']});
google.setOnLoadCallback(drawMap);
function drawMap() {
var data = google.visualization.arrayToDataTable([
['City', 'Number of tweet for moto x'],
['Eastern Time (US & Canada)', 12417],
['Central Time (US & Canada)', 7738],
['Pacific Time (US & Canada)', 6915],
['Beijing', 5100],
['Brasilia', 12228],
['Kuala Lumpur', 5003],
['Buenos Aires', 3630],
['Santiago', 3264],
['Bangkok', 3081],
['Jakarta', 2889],
['Athens', 2450],
['London', 2397],
['Quito', 2323],
['Atlantic Time (Canada)', 2195],
['Caracas', 2075],
['Amsterdam', 2020],
['Madrid', 1941],
['Arizona', 1746],
['Mexico City', 1673],
['Hawaii', 1613],
['Mountain Time (US & Canada)', 1552],
['Greenland', 1332],
['Alaska', 1146],
['Tokyo', 987],
['Chennai', 970],
['Paris', 872],
['New Delhi', 775],
['Rome', 755],
['Baghdad', 744],
['Bogota', 681],
]);
var options = {};
//options['colors'] = [0xFF8747, 0xFFB581, 0xc06000]; //orange colors
options['colors'] = [0xFFA500, 0xFF4500]; //orange colors
options['dataMode'] = 'markers';
options['title'] = 'Amount of tweet for moto x';
options['width'] = 1200;
options['height'] = 800;
var container = document.getElementById('map_canvas');
var geomap = new google.visualization.GeoMap(container);
geomap.draw(data, options);
};
</script>
</head>
<body>
<div id='map_canvas'></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment