31
30

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GoogleChartsのGeochartで都道府県分布マップを簡単作成

Last updated at Posted at 2014-09-03

GoogleChart便利ですね。
下記のような分布マップを簡単に作成できます。

スクリーンショット 2014-09-03 12.45.44.png

<script src="https://www.google.com/jsapi"></script>
<script>
google.load('visualization', '1', {packages:['geochart']});
google.setOnLoadCallback(graphChart);

function graphChart() {
  var data = google.visualization.arrayToDataTable([
    ["都道府県", "データ"], 
    ["北海道", 20], 
    ["青森", 3], 
    ...
  ]);

  var option = {
    region: 'JP',
    resolution: 'provinces'
  };

  var chart = new google.visualization.GeoChart(document.getElementById('chart'));
  chart.draw(data, option);
}
</script>

<div id="chart"></div>

都道府県のデータを入れてるところで適切にデータを入れれば簡単に分布マップを作成してくれます。
「青森県」じゃなくて「青森」にしないとうまく動作しないので要注意です。

31
30
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
31
30

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?