Permalink
Browse files

oops, I messed up again with git.... still learning

  • Loading branch information...
1 parent 1d0e831 commit a06a416edb71fc76363ba10373eb4c36c82254e1 @madewulf committed May 20, 2011
Showing with 168 additions and 14 deletions.
  1. +52 −0 popsize.html
  2. +97 −0 popsize.js
  3. +7 −14 pyramid.js
  4. +12 −0 python_scripts/tot_pop.py
View
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+ <head>
+ <title>Population Pyramids of the Whole World - from 1950 to 2050 - PopulationPyramid.net</title>
+ <meta property="og:title" content="PopulationPyramid.net"/>
+ <meta property="og:type" content="website"/>
+ <meta property="og:url" content="http://populationpyramid.net/"/>
+ <meta property="og:image" content="http://populationpyramid.net/media/facebook-image.png"/>
+ <meta property="og:site_name" content="PopulationPyramid.net"/>
+ <meta property="fb:admins" content="548900828"/>
+ <meta property="og:description"
+ content="Interactive Visualization of the Population Pyramids of the World from 1950 to 2050"/>
+ <meta charset="utf-8" />
+ <META name="description" content="Visualization of the population pyramids of the world, based on the United Nations data."/>
+ <META name="keywords" content="Population, Pyramid, Demographics, Visualization"/>
+ <link href='http://fonts.googleapis.com/css?family=Nobile:regular,bold,italic,bolditalic' rel='stylesheet' type='text/css'>
+ <script type="text/javascript" src="/js/flot/jquery.min.js"></script>
+ <script type="text/javascript" src="/js/flot/jquery.flot.min.js"></script>
+ <script type="text/javascript" src="/popsize.js"></script>
+
+ <link rel="shortcut icon" href="favicon.ico">
+ <script type="text/javascript">
+
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-21050559-1']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+
+ </script>
+
+
+ </head>
+ <body>
+ <div id="graph" style="width:600px;height:300px"></div>
+
+ <div id="alpha_list_div" style="clear:both;float:left;margin:30px;">
+ <div style="margin-left:11px;">
+ <ul id="alpha_list">
+ </ul>
+ </div>
+ </div>
+ <div id="country_list_div" style="margin:50px;">
+ <ul id="country_list">
+
+ </ul>
+ </div>
+ </body>
+</html>
View
@@ -0,0 +1,97 @@
+var country_dict = {"a": [["Afghanistan", "Afghanistan"], ["Albania", "Albania"], ["Algeria", "Algeria"], ["Angola", "Angola"], ["Argentina", "Argentina"], ["Armenia", "Armenia"], ["Aruba", "Aruba"], ["Australia", "Australia"], ["Austria", "Austria"], ["Azerbaijan", "Azerbaijan"], ["Africa", "Africa"], ["Asia", "Asia"]], "c": [["Cambodia", "Cambodia"], ["Cameroon", "Cameroon"], ["Canada", "Canada"], ["Cape_Verde", "Cape Verde"], ["Central_African_Republic", "Central African Republic"], ["Chad", "Chad"], ["Channel_Islands", "Channel Islands"], ["Chile", "Chile"], ["China", "China"], ["China,_Hong_Kong_Special_Administrative_Region", "China, Hong Kong Special Administrative Region"], ["China,_Macao_Special_Administrative_Region", "China, Macao Special Administrative Region"], ["Colombia", "Colombia"], ["Comoros", "Comoros"], ["Congo", "Congo"], ["Costa_Rica", "Costa Rica"], ["Cote_d'Ivoire", "C\u00f4te d'Ivoire"], ["Croatia", "Croatia"], ["Cuba", "Cuba"], ["Cyprus", "Cyprus"], ["Czech_Republic", "Czech Republic"], ["Caribbean", "Caribbean"], ["Central_America", "Central America"]], "b": [["Bahamas", "Bahamas"], ["Bahrain", "Bahrain"], ["Bangladesh", "Bangladesh"], ["Barbados", "Barbados"], ["Belarus", "Belarus"], ["Belgium", "Belgium"], ["Belize", "Belize"], ["Benin", "Benin"], ["Bhutan", "Bhutan"], ["Bolivia", "Bolivia"], ["Bosnia_and_Herzegovina", "Bosnia and Herzegovina"], ["Botswana", "Botswana"], ["Brazil", "Brazil"], ["Brunei_Darussalam", "Brunei Darussalam"], ["Bulgaria", "Bulgaria"], ["Burkina_Faso", "Burkina Faso"], ["Burundi", "Burundi"]], "e": [["Ecuador", "Ecuador"], ["Egypt", "Egypt"], ["El_Salvador", "El Salvador"], ["Equatorial_Guinea", "Equatorial Guinea"], ["Eritrea", "Eritrea"], ["Estonia", "Estonia"], ["Ethiopia", "Ethiopia"], ["Eastern_Africa", "Eastern Africa"], ["Eastern_Asia", "Eastern Asia"], ["Europe", "Europe"], ["Eastern_Europe", "Eastern Europe"]], "d": [["Democratic_People's_Republic_of_Korea", "Democratic People's Republic of Korea"], ["Democratic_Republic_of_the_Congo", "Democratic Republic of the Congo"], ["Denmark", "Denmark"], ["Djibouti", "Djibouti"], ["Dominican_Republic", "Dominican Republic"]], "g": [["Gabon", "Gabon"], ["Gambia", "Gambia"], ["Georgia", "Georgia"], ["Germany", "Germany"], ["Ghana", "Ghana"], ["Greece", "Greece"], ["Grenada", "Grenada"], ["Guadeloupe", "Guadeloupe"], ["Guam", "Guam"], ["Guatemala", "Guatemala"], ["Guinea", "Guinea"], ["Guinea-Bissau", "Guinea-Bissau"], ["Guyana", "Guyana"]], "f": [["Federated_States_of_Micronesia", "Federated States of Micronesia"], ["Fiji", "Fiji"], ["Finland", "Finland"], ["France", "France"], ["French_Guiana", "French Guiana"], ["French_Polynesia", "French Polynesia"]], "i": [["Iceland", "Iceland"], ["India", "India"], ["Indonesia", "Indonesia"], ["Iran", "Iran (Islamic Republic of)"], ["Iraq", "Iraq"], ["Ireland", "Ireland"], ["Israel", "Israel"], ["Italy", "Italy"]], "h": [["Haiti", "Haiti"], ["Honduras", "Honduras"], ["Hungary", "Hungary"]], "k": [["Kazakhstan", "Kazakhstan"], ["Kenya", "Kenya"], ["Kuwait", "Kuwait"], ["Kyrgyzstan", "Kyrgyzstan"]], "j": [["Jamaica", "Jamaica"], ["Japan", "Japan"], ["Jordan", "Jordan"]], "m": [["Madagascar", "Madagascar"], ["Malawi", "Malawi"], ["Malaysia", "Malaysia"], ["Maldives", "Maldives"], ["Mali", "Mali"], ["Malta", "Malta"], ["Martinique", "Martinique"], ["Mauritania", "Mauritania"], ["Mauritius", "Mauritius"], ["Mayotte", "Mayotte"], ["Mexico", "Mexico"], ["Mongolia", "Mongolia"], ["Montenegro", "Montenegro"], ["Morocco", "Morocco"], ["Mozambique", "Mozambique"], ["Myanmar", "Myanmar"], ["More_developed_regions", "More developed regions"], ["Middle_Africa", "Middle Africa"], ["Melanesia", "Melanesia"], ["Micronesia", "Micronesia"]], "l": [["Lao", "Lao People's Democratic Republic"], ["Latvia", "Latvia"], ["Lebanon", "Lebanon"], ["Lesotho", "Lesotho"], ["Liberia", "Liberia"], ["Libyan_Arab_Jamahiriya", "Libyan Arab Jamahiriya"], ["Lithuania", "Lithuania"], ["Luxembourg", "Luxembourg"], ["Less_developed_regions", "Less developed regions"], ["Least_developed_countries", "Least developed countries"], ["Less_developed_regions,_excluding_least_developed_countries", "Less developed regions, excluding least developed countries"], ["Less_developed_regions,_excluding_China", "Less developed regions, excluding China"], ["Latin_America_and_the_Caribbean", "Latin America and the Caribbean"]], "o": [["Occupied_Palestinian_Territory", "Occupied Palestinian Territory"], ["Oman", "Oman"], ["Oceania", "Oceania"]], "n": [["Namibia", "Namibia"], ["Nepal", "Nepal"], ["Netherlands", "Netherlands"], ["Netherlands_Antilles", "Netherlands Antilles"], ["New_Caledonia", "New Caledonia"], ["New_Zealand", "New Zealand"], ["Nicaragua", "Nicaragua"], ["Niger", "Niger"], ["Nigeria", "Nigeria"], ["Norway", "Norway"], ["Northern_Africa", "Northern Africa"], ["Northern_Europe", "Northern Europe"], ["Northern_America", "Northern America"]], "q": [["Qatar", "Qatar"]], "p": [["Pakistan", "Pakistan"], ["Panama", "Panama"], ["Papua_New_Guinea", "Papua New Guinea"], ["Paraguay", "Paraguay"], ["Peru", "Peru"], ["Philippines", "Philippines"], ["Poland", "Poland"], ["Portugal", "Portugal"], ["Puerto_Rico", "Puerto Rico"], ["Polynesia", "Polynesia"]], "s": [["Saint_Lucia", "Saint Lucia"], ["Saint_Vincent_and_the_Grenadines", "Saint Vincent and the Grenadines"], ["Samoa", "Samoa"], ["Sao_Tome_and_Principe", "Sao Tome and Principe"], ["Saudi_Arabia", "Saudi Arabia"], ["Senegal", "Senegal"], ["Serbia", "Serbia"], ["Sierra_Leone", "Sierra Leone"], ["Singapore", "Singapore"], ["Slovakia", "Slovakia"], ["Slovenia", "Slovenia"], ["Solomon_Islands", "Solomon Islands"], ["Somalia", "Somalia"], ["South_Africa", "South Africa"], ["Spain", "Spain"], ["Sri_Lanka", "Sri Lanka"], ["Sudan", "Sudan"], ["Suriname", "Suriname"], ["Swaziland", "Swaziland"], ["Sweden", "Sweden"], ["Switzerland", "Switzerland"], ["Syrian_Arab_Republic", "Syrian Arab Republic"], ["Sub-Saharan_Africa", "Sub-Saharan Africa"], ["Southern_Africa", "Southern Africa"], ["South-Central_Asia", "South-Central Asia"], ["South-Eastern_Asia", "South-Eastern Asia"], ["Southern_Europe", "Southern Europe"], ["South_America", "South America"]], "r": [["Republic_of_Korea", "Republic of Korea"], ["Republic_of_Moldova", "Republic of Moldova"], ["Reunion", "R\u00e9union"], ["Romania", "Romania"], ["Russian_Federation", "Russian Federation"], ["Rwanda", "Rwanda"]], "u": [["Uganda", "Uganda"], ["Ukraine", "Ukraine"], ["United_Arab_Emirates", "United Arab Emirates"], ["United_Kingdom", "United Kingdom"], ["United_Republic_of_Tanzania", "United Republic of Tanzania"], ["United_States_of_America", "United States of America"], ["United_States_Virgin_Islands", "United States Virgin Islands"], ["Uruguay", "Uruguay"], ["Uzbekistan", "Uzbekistan"]], "t": [["Tajikistan", "Tajikistan"], ["Thailand", "Thailand"], ["The_former_Yugoslav_Republic_of_Macedonia", "The former Yugoslav Republic of Macedonia"], ["Timor-Leste", "Timor-Leste"], ["Togo", "Togo"], ["Tonga", "Tonga"], ["Trinidad_and_Tobago", "Trinidad and Tobago"], ["Tunisia", "Tunisia"], ["Turkey", "Turkey"], ["Turkmenistan", "Turkmenistan"]], "w": [["Western_Sahara", "Western Sahara"], ["World", "World"], ["Western_Africa", "Western Africa"], ["Western_Asia", "Western Asia"], ["Western_Europe", "Western Europe"]], "v": [["Vanuatu", "Vanuatu"], ["Venezuela", "Venezuela (Bolivarian Republic of)"], ["Viet_Nam", "Viet Nam"]], "y": [["Yemen", "Yemen"]], "z": [["Zambia", "Zambia"], ["Zimbabwe", "Zimbabwe"]]};
+var currentCountry;
+var currentCountryName;
+var data;
+var options={grid: {borderWidth: 1, hoverable: true, color: "green"}};
+function keys(obj)
+{
+ var keysList = [];
+ var key;
+ for( key in obj)
+ {
+ keysList.push(key);
+ }
+
+ return keysList;
+}
+function treatCountryClick(event)
+{
+ event.preventDefault();
+
+ var country= $(this).attr("id");
+ currentCountryName =$(this).attr("na");
+ currentCountry = country;
+ $.plot($('#graph'),[ data[country] ],options);
+}
+$(function(){
+
+
+ var hover = {
+ show: function(x, y, message) {
+ $('<div id="hover">').html(message)
+ .css({top: y, left: x})
+ .appendTo('body')
+ .show();
+ },
+ hide: function() {
+ $("#hover").remove();
+ }
+ };
+ $.getJSON('/data/tot_pop.json', function(response) {
+ data= response;
+
+ var plot = $.plot($('#graph'),[ data.Azerbaijan ],options);
+ $('#graph').bind("plothover", function(event, pos, item) {
+ if (item) {
+ if (previousPoint != item.dataIndex) {
+ previousPoint = item.dataIndex;
+ hover.hide();
+ var message = "coucou";
+
+ var x = item.pageX + 10, y = item.pageY + 10;
+
+ hover.show(x, y, message);
+ }
+ } else {
+ hover.hide();
+ previousPoint = null;
+ }
+ });
+ var alphabet= keys(country_dict).sort();
+ var alpha_length = alphabet.length;
+ for ( i=0;i<alpha_length;i++)
+ {
+
+ $("#alpha_list").append('<li><a class="alpha_link" href="" id="'+alphabet[i]+'">'+alphabet[i].toUpperCase()+'</a></li>');
+ }
+ var country_list= country_dict['a'];
+ var country_count = country_list.length;
+ for ( i=0;i<country_count;i++)
+ {
+ $("#country_list").append('<li><a class="country_link" href="" id="'+country_list[i][0]+'" na="'+country_list[i][1]+'">'+country_list[i][1]+"</a></li>");
+ }
+
+ $(".country_link").click(treatCountryClick);
+ $(".alpha_link").click(function(event)
+ {
+ event.preventDefault();
+ var letter= $(this).attr("id");
+ currentLetter = letter;
+ $('#country_list').hide(300,function(){
+ var i;
+ $("#country_list").empty();
+ $(".country_link").remove();
+
+ var country_list= country_dict[letter];
+ var country_count = country_list.length;
+ for (i=0;i<country_count;i++)
+ {
+ $("#country_list").append('<li><a class="country_link" href="" id="'+country_list[i][0]+'" na="'+country_list[i][1]+'">'+country_list[i][1]+"</a></li>");
+ }
+
+ $(".country_link").click(treatCountryClick);
+ $('#country_list').show();
+ });
+ });
+ });
+});
View
Oops, something went wrong.
Oops, something went wrong.

0 comments on commit a06a416

Please sign in to comment.