2013-05-15 2 views
2

미국, 한국, 대만, 중국 및 인도의 도시가 포함 된 Google 지리 차트를 생성 중입니다. regions: 'world'을 사용하면 맵이 너무 커서 도시 버블이 거의 보이지 않습니다. 나는 다음과 같은 옵션을 사용하고 있습니다 :동일한지도에 여러 개의 Google 차트 영역 표시

var options = { 
    region: 'world', 
    displayMode: 'markers', 
    resolution: 'provinces' 
} 

가 두 개 이상의 영역으로지도를 만들 수 있을까?

예 : 미국 및 아시아. 다음과 같이 영역을 설정하려고합니다.

var options = { 
    region: '019','142', 
    displayMode: 'markers', 
    resolution: 'provinces' 
} 

답변

1

아니요, 동일한지도에 두 개의 영역으로 구성된지도를 만들 수 없습니다.

이유는 Google geocharts가 보여주는 지역의 SVG 이미지에 의존하기 때문에 API 내에 SVG지도가 제한되어 있기 때문에 (일부 국가에서는 resolution: 'provinces'으로 작동하지 않는 이유가 여기에 해당됩니다).

그러나 두 지역의 데이터로 데이터 테이블을 만들 수 있으며 동일한 데이터 테이블을 사용하여 두 개의 별도지도 (각 지역 중 하나)를 채울 수 있습니다. 예를 들어

:

<!-- 
You are free to copy and use this sample in accordance with the terms of the 
Apache license (http://www.apache.org/licenses/LICENSE-2.0.html) 
--> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
    <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
    <title>Google Visualization API Sample</title> 
    <script type="text/javascript" src="http://www.google.com/jsapi"></script> 
    <script type="text/javascript"> 
     google.load('visualization', '1', {packages: ['geochart']}); 

     function drawVisualization() { 
     var data = google.visualization.arrayToDataTable([ 
      ['Country', 'Popularity'], 
      ['Germany', 200], 
      ['United States', 300], 
      ['Brazil', 400], 
      ['Canada', 500], 
      ['France', 600], 
      ['RU', 700] 
     ]); 

     // Draw First Chart 
     var geochart = new google.visualization.GeoChart(
      document.getElementById('visualization')); 
     geochart.draw(data, {width: 556, height: 347, region: '019', resolution: 'countries'}); 

     // Draw Second Chart 
     var geochart2 = new google.visualization.GeoChart(
      document.getElementById('visualization2')); 
     geochart2.draw(data, {width: 556, height: 347, region: '150', resolution: 'countries'}); 
     } 


     google.setOnLoadCallback(drawVisualization); 
    </script> 
    </head> 
    <body style="font-family: Arial;border: 0 none;"> 
    <div id="visualization"></div> 
    <div id="visualization2"></div> 
    </body> 
</html> 

는 또한 "아메리카"지역 (019)은 세계지도로 높이, 실제로 "세계"를 통해 당신에게 공간을 저장하지 않습니다. 캐나다 나 멕시코에 마커가없는 경우 북미 또는 '미국'을 사용할 것을 제안합니다.