Language
Login
Language Setting
X
English
日本語 [Japanese]
about this App
都道府県人口推移の可視化
useful
0
Loading...
/* $(function() { var spinner = $( "#spinner" ).spinner(); }); */ if(typeof Application==="undefined"||!Application){var Application= {};} Application.gc = function() { this._init.apply(this, arguments); } var data_array = new Array(); Application.gc.prototype = { _data : null, _options : null, _init : function() { this._data = this._getGoogleDataTable(); this._options = this._getGoogleOption(); }, _configArray : function() { var array = [ { "caption" : "Latitude", "property" : "lat" }, { "caption" : "Longitude", "property" : "long" }, { "caption" : "Location", "property" : "label" }, { "caption" : "人口", "property" : "population" } ]; return array; }, _getGoogleOption : function() { var options = { region: 'JP', displayMode: 'markers', colorAxis: {colors: ['yellow', 'red']} }; return options; }, _getGoogleDataTable : function() { var configArray = this._configArray(); var main = []; var array = []; $.each(configArray, function(index, obj) { array.push(obj.caption); }); main.push(array); var mainArray = this._getObjectArray(); $.each(mainArray, function(i, objArray) { array = []; $.each(objArray, function(j, objData) { $.each(configArray, function(k, obj) { if (objData.property === obj.property) { var val = objData.value; if (! isNaN(val)) { if (Math.floor(val).toString() == val.toString()) { // yay! we have an int val = parseInt(val); } else { // it's a float or something else. val = parseFloat(val); } /*if (val.substr(0,1) == "H") { console.log(val); continue; }*/ } array[k] = val; } }); }); main.push(array); }); return main; }, _getObjectArray : function() { var main = []; $.each(LinkData.getWorks(), function(workKey, workValue) { $.each(LinkData.getFiles(workValue), function(fileKey, fileValue) { $.each(LinkData.getSubjects(workValue, fileValue), function(subjKey, subjValue) { var array = []; $.each(LinkData.getProperties(workValue, fileValue), function(propKey, propValue) { var obj = {}; var propLabel = propValue; var arr = propValue.split("#"); if (arr.length > 1) { propLabel = decodeURIComponent(arr[1]); } var objValue = LinkData.getObjects(workValue, fileValue, subjValue, propValue)[0]; obj.property = propLabel; obj.value = objValue; array.push(obj); }); main.push(array); }); }); }); return main; }, getData : function() { data_array = new Array(); for (var i = 1920; i < 2001; i++) { data_array.push(sliceYear(this._data, i)); } }, getOptions : function() { return this._options; } } function sliceYear(data, year) { var start = year - 1920 + 1; var end = start + 48; var y_data = data.slice(0,1).concat(data.slice(start, end)); //console.log(y_data); return y_data; } var drawMarkersMap = function() { var gc = new Application.gc(); gc.getData(); var data = google.visualization.arrayToDataTable(data_array[0]); var options = gc.getOptions(); var chart = new google.visualization.GeoChart(document.getElementById('chart_div')); chart.draw(data, options); } function switchYear(year) { var gc = new Application.gc(); var data = google.visualization.arrayToDataTable(data_array[year-1920]); var options = gc.getOptions(); var chart = new google.visualization.GeoChart(document.getElementById('chart_div')); chart.draw(data, options); } google.load('visualization', '1', {'packages': ['geochart']}); google.setOnLoadCallback(drawMarkersMap);
<h2>都道府県人口推移の可視化</h2> <div id="chart_div" style="width: 900px; height: 500px;"></div> <input id="spinner" name="value" />
Preview
Input Data
ReadMe
Snapshots
LinkData Work
Table Data
H00001: 日本の県別人口推移 1920-2000
Contributor:Sayoko Shimoyama
Update:Apr 20, 2013
343 Downloads, 1 Applications
e-Statで提供されている総務省の国勢調査による人口推移データです。下記URLの5.都道府県別人口(各年10月1日現在)-総人口(大正9年~平成12年)のファイルから情報を取得しました。<a href="http://www.e-stat.go.jp/SG1/estat/List.do?bid=000000090004&cycode=0" target="_blank">http://www.e-stat.go.jp/SG1/estat/List.do?bid=000000090004&cycode=0</a>
H00001_population_from1920_to2000
[
]
Add LinkData work(LinkData)
Link http://app.linkdata.org/run/app1s494i?tab=readme
Initial content
jquery-1.7.1.min.js
https://www.google.com/jsapi
jquery-ui-1.8.18.min.js
Work
Add
Clear
insert work id or work name.