Google GeoChart - " Sub-Continents"

时间:2016-03-15 15:46:14

标签: google-visualization

我无法突出显示"北美"。我尝试过很多不同的东西,#34;大陆"," Sub-Contninets"等等。如果我只想突出北美?

第一个例子不起作用。 我的第二个确实只突出了主要的大陆地区。



<html>
<head>
    <div id="regions_div" style="width: 900px; height: 500px;"></div>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js?sensor=false&callback=initialize"></script>
    <script type="text/javascript" src="https://www.google.com/jsapi?sensor=false"></script>
    <script type="text/javascript">
    google.charts.load('current', {'packages':['geochart']});
    google.charts.setOnLoadCallback(drawRegionsMap);

    function drawRegionsMap() {

    var data = google.visualization.arrayToDataTable([
              ['Region Code', 'Sub-Continent', 'Popularity'],
              ['142', 'Asia', 0],
              ['150', 'Europe', 900],
              ['021', 'Northern America', 300],
              ['013', 'Central America', 300],
              ['005', 'South America', 900],
              ['009', 'Oceania', 300],
              ['002', 'Africa', 300]
    ]);

    var options = {resolution: 'sub-continents'};

    var chart = new google.visualization.GeoChart(document.getElementById('regions_div'));

    chart.draw(data, options);
    }
</script>
</html>
&#13;
&#13;
&#13;

&#13;
&#13;
<html>
<head>
    <div id="regions_div" style="width: 900px; height: 500px;"></div>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js?sensor=false&callback=initialize"></script>
    <script type="text/javascript" src="https://www.google.com/jsapi?sensor=false"></script>
    <script type="text/javascript">
    google.charts.load('current', {'packages':['geochart']});
    google.charts.setOnLoadCallback(drawRegionsMap);

    function drawRegionsMap() {

    var data = google.visualization.arrayToDataTable([
              ['Region Code', 'Continent', 'Popularity'],
              ['142', 'Asia', 0],
              ['150', 'Europe', 900],
              ['021', 'Northern America', 300],
              ['013', 'Central America', 300],
              ['005', 'South America', 900],
              ['009', 'Oceania', 300],
              ['002', 'Africa', 300]
    ]);

    var options = {resolution: 'continents'};

    var chart = new google.visualization.GeoChart(document.getElementById('regions_div'));

    chart.draw(data, options);
    }
</script>
</html>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:2)

我明白了。

  var options = {
      resolution: 'subcontinents'
  };