Creo en nosotros. Wikipedia.
ShareCode
Permalink: http://www.treeweb.es/u/974/ 01/02/2011

ShareCode

1 <script type='text/javascript' src='https://www.google.com/jsapi'></script>2 <div id="chart_div" style="width: 900px; height: 500px;"></div>3 4 <script type="text/javascript">5 6 // First: Preprocess data from mongo7 var countries_by_prefix = {}; // Index countries by prefix8 for (var k in db_countries) {9  var item = db_countries[k];10  countries_by_prefix[item.prefix] = item;11 }12 13 var chart_data = [['Country', 'Roamers']];14 15 var log_10 = Math.log(10);16 17 for (var k in db_aggregation) {18  var item = db_aggregation[k];19  console.log(item);20  country = countries_by_prefix[item._id]21  if (country != undefined) {22  chart_data[chart_data.length] = [country.iso_code, ( Math.log(item.n) / log_10 ) ];23  }24 }25 26 console.log(chart_data);27 28 /*29 var chart_data = [30  ['Country', 'Popularity'],31  ['Germany', 200],32  ['United States', 300],33  ['Brazil', 400],34  ['Canada', 500],35  ['France', 600],36  ['RU', 700]37 ];38 */39 40 google.load('visualization', '1', {'packages': ['geochart']});41 google.setOnLoadCallback(drawRegionsMap);42 43 function drawRegionsMap() {44 var data = google.visualization.arrayToDataTable(chart_data);45 46 var options = {};47 48 var chart = new google.visualization.GeoChart(document.getElementById('chart_div'));49 chart.draw(data, options);50 };51 52 </script>


Este ShareCode tiene versiones:
  1. // First: Preprocess data from mong... (03/06/2014)
Enlace
El enlace para compartir es: