Skip to content

Instantly share code, notes, and snippets.

@revelutions
Last active December 13, 2015 23:49
Show Gist options
  • Save revelutions/4994934 to your computer and use it in GitHub Desktop.
Save revelutions/4994934 to your computer and use it in GitHub Desktop.
GDP of all countries (derived from Mike Bostock's work)
{
"name": "Area",
"children": [
{
"name": "group0",
"children": [
{
"name": "Tokelau",
"size": 1500000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/tl.html"
},
{
"name": "Niue",
"size": 10010000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ne.html"
},
{
"name": "Saint Helena, Ascension, and Tristan da Cunha",
"size": 18000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/sh.html"
},
{
"name": "Tuvalu",
"size": 36000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/tv.html"
},
{
"name": "Montserrat",
"size": 43780000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/mh.html"
},
{
"name": "Saint Pierre and Miquelon",
"size": 48300000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/sb.html"
},
{
"name": "Wallis and Futuna",
"size": 60000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/wf.html"
},
{
"name": "Nauru",
"size": 60000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/nr.html"
},
{
"name": "Marshall Islands",
"size": 133500000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/rm.html"
},
{
"name": "Palau",
"size": 164000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ps.html"
},
{
"name": "Falkland Islands (Islas Malvinas)",
"size": 164500000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/fk.html"
},
{
"name": "Anguilla",
"size": 175400000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/av.html"
},
{
"name": "Cook Islands",
"size": 183200000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/cw.html"
},
{
"name": "Turks and Caicos Islands",
"size": 216000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/tk.html"
},
{
"name": "Micronesia, Federated States of",
"size": 238100000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/fm.html"
},
{
"name": "Sao Tome and Principe",
"size": 379000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/tp.html"
},
{
"name": "American Samoa",
"size": 575300000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/aq.html"
},
{
"name": "Kiribati",
"size": 599000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/kr.html"
},
{
"name": "Tonga",
"size": 763000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/tn.html"
},
{
"name": "Sint Maarten",
"size": 794700000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/sk.html"
},
{
"name": "Comoros",
"size": 837000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/cn.html"
},
{
"name": "British Virgin Islands",
"size": 853400000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/vi.html"
},
{
"name": "Saint Kitts and Nevis",
"size": 875000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/sc.html"
},
{
"name": "Northern Mariana Islands",
"size": 900000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/cq.html"
},
{
"name": "Western Sahara",
"size": 906500000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/wi.html"
},
{
"name": "Dominica",
"size": 1014000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/do.html"
},
{
"name": "Samoa",
"size": 1094000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ws.html"
},
{
"name": "Vanuatu",
"size": 1186000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/nh.html"
},
{
"name": "Saint Vincent and the Grenadines",
"size": 1264000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/vc.html"
},
{
"name": "Gibraltar",
"size": 1275000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/gi.html"
},
{
"name": "San Marino",
"size": 1371000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/sm.html"
},
{
"name": "Grenada",
"size": 1440000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/gj.html"
},
{
"name": "Faroe Islands",
"size": 1471000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/fo.html"
},
{
"name": "Antigua and Barbuda",
"size": 1495000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ac.html"
},
{
"name": "Virgin Islands",
"size": 1577000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/vq.html"
},
{
"name": "Solomon Islands",
"size": 1761000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/bp.html"
},
{
"name": "Guinea-Bissau",
"size": 1925000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/pu.html"
},
{
"name": "Cape Verde",
"size": 2052000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/cv.html"
},
{
"name": "Greenland",
"size": 2133000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/gl.html"
},
{
"name": "Saint Lucia",
"size": 2183000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/st.html"
},
{
"name": "Djibouti",
"size": 2231000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/dj.html"
},
{
"name": "Cayman Islands",
"size": 2250000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/cj.html"
},
{
"name": "Aruba",
"size": 2258000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/aa.html"
},
{
"name": "Seychelles",
"size": 2302000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/se.html"
},
{
"name": "Liberia",
"size": 2432000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/li.html"
},
{
"name": "Guam",
"size": 2500000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/gq.html"
},
{
"name": "Isle of Man",
"size": 2719000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/im.html"
},
{
"name": "Guernsey",
"size": 2742000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/gk.html"
},
{
"name": "Belize",
"size": 2786000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/bh.html"
},
{
"name": "Maldives",
"size": 2800000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/mv.html"
}
]
},
{
"name": "group1",
"children": [
{
"name": "Curacao",
"size": 2838000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/uc.html"
},
{
"name": "New Caledonia",
"size": 3158000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/nc.html"
},
{
"name": "Andorra",
"size": 3169000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/an.html"
},
{
"name": "Liechtenstein",
"size": 3200000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ls.html"
},
{
"name": "Gambia, The",
"size": 3496000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ga.html"
},
{
"name": "Central African Republic",
"size": 3636000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ct.html"
},
{
"name": "Lesotho",
"size": 3723000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/lt.html"
},
{
"name": "Eritrea",
"size": 4037000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/er.html"
},
{
"name": "Fiji",
"size": 4153000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/fj.html"
},
{
"name": "Bhutan",
"size": 4309000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/bt.html"
},
{
"name": "Bermuda",
"size": 4500000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/bd.html"
},
{
"name": "French Polynesia",
"size": 4718000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/fp.html"
},
{
"name": "Jersey",
"size": 5100000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/je.html"
},
{
"name": "Burundi",
"size": 5184000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/by.html"
},
{
"name": "Monaco",
"size": 5470000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/mn.html"
},
{
"name": "Guyana",
"size": 5851000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/gy.html"
},
{
"name": "Somalia",
"size": 5896000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/so.html"
},
{
"name": "Swaziland",
"size": 6231000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/wz.html"
},
{
"name": "Suriname",
"size": 6326000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ns.html"
},
{
"name": "Togo",
"size": 6464000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/to.html"
},
{
"name": "Zimbabwe",
"size": 6474000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/zi.html"
},
{
"name": "Sierra Leone",
"size": 6795000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/sl.html"
},
{
"name": "Barbados",
"size": 6929000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/bb.html"
},
{
"name": "Mauritania",
"size": 7115000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/mr.html"
},
{
"name": "Montenegro",
"size": 7157000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/mj.html"
},
{
"name": "Timor-Leste",
"size": 9507000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/tt.html"
},
{
"name": "Bahamas, The",
"size": 10600000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/bf.html"
},
{
"name": "Malta",
"size": 10830000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/mt.html"
},
{
"name": "Guinea",
"size": 11500000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/gv.html"
},
{
"name": "Niger",
"size": 11630000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ng.html"
},
{
"name": "Moldova",
"size": 12000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/md.html"
},
{
"name": "Haiti",
"size": 12370000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ha.html"
},
{
"name": "Iceland",
"size": 12410000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ic.html"
},
{
"name": "West Bank",
"size": 12790000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/we.html"
},
{
"name": "Kosovo",
"size": 12860000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/kv.html"
},
{
"name": "Kyrgyzstan",
"size": 13130000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/kg.html"
},
{
"name": "Mongolia",
"size": 13290000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/mg.html"
},
{
"name": "Rwanda",
"size": 13620000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/rw.html"
},
{
"name": "Malawi",
"size": 13760000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/mi.html"
},
{
"name": "Benin",
"size": 14750000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/bn.html"
},
{
"name": "Namibia",
"size": 15930000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/wa.html"
},
{
"name": "Tajikistan",
"size": 16220000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ti.html"
},
{
"name": "Papua New Guinea",
"size": 16860000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/pp.html"
},
{
"name": "Laos",
"size": 17410000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/la.html"
},
{
"name": "Mali",
"size": 17880000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ml.html"
},
{
"name": "Armenia",
"size": 17970000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/am.html"
},
{
"name": "Congo, Republic of the",
"size": 18070000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/cf.html"
},
{
"name": "Macau",
"size": 18470000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/mc.html"
},
{
"name": "Nicaragua",
"size": 18880000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/nu.html"
},
{
"name": "Mauritius",
"size": 19290000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/mp.html"
}
]
},
{
"name": "group2",
"children": [
{
"name": "Chad",
"size": 19560000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/cd.html"
},
{
"name": "Madagascar",
"size": 20640000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ma.html"
},
{
"name": "Brunei",
"size": 21030000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/bx.html"
},
{
"name": "South Sudan",
"size": 21120000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/od.html"
},
{
"name": "Macedonia",
"size": 21590000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/mk.html"
},
{
"name": "Zambia",
"size": 21880000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/za.html"
},
{
"name": "Burkina Faso",
"size": 22100000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/uv.html"
},
{
"name": "Cyprus",
"size": 23720000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/cy.html"
},
{
"name": "Mozambique",
"size": 24000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/mz.html"
},
{
"name": "Georgia",
"size": 24540000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/gg.html"
},
{
"name": "Jamaica",
"size": 24560000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/jm.html"
},
{
"name": "Gabon",
"size": 24770000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/gb.html"
},
{
"name": "Senegal",
"size": 25150000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/sg.html"
},
{
"name": "Congo, Democratic Republic of the",
"size": 25290000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/cg.html"
},
{
"name": "Albania",
"size": 25320000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/al.html"
},
{
"name": "Equatorial Guinea",
"size": 26100000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ek.html"
},
{
"name": "Trinidad and Tobago",
"size": 26490000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/td.html"
},
{
"name": "Estonia",
"size": 27310000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/en.html"
},
{
"name": "Afghanistan",
"size": 29740000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/af.html"
},
{
"name": "Botswana",
"size": 29850000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/bc.html"
},
{
"name": "Bahrain",
"size": 31300000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ba.html"
},
{
"name": "Bosnia and Herzegovina",
"size": 31570000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/bk.html"
},
{
"name": "Cambodia",
"size": 33820000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/cb.html"
},
{
"name": "Latvia",
"size": 34890000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/lg.html"
},
{
"name": "Honduras",
"size": 35700000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ho.html"
},
{
"name": "Cote d'Ivoire",
"size": 36070000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/iv.html"
},
{
"name": "Jordan",
"size": 36940000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/jo.html"
},
{
"name": "Nepal",
"size": 38080000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/np.html"
},
{
"name": "Libya",
"size": 38980000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ly.html"
},
{
"name": "Korea, North",
"size": 40000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/kn.html"
},
{
"name": "Paraguay",
"size": 40640000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/pa.html"
},
{
"name": "Luxembourg",
"size": 41450000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/lu.html"
},
{
"name": "Turkmenistan",
"size": 43340000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/tx.html"
}
]
},
{
"name": "group3",
"children": [
{
"name": "El Salvador",
"size": 44580000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/es.html"
},
{
"name": "Cameroon",
"size": 47300000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/cm.html"
},
{
"name": "Uganda",
"size": 47780000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ug.html"
},
{
"name": "Panama",
"size": 50610000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/pm.html"
},
{
"name": "Uruguay",
"size": 50910000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/uy.html"
},
{
"name": "Bolivia",
"size": 50940000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/bl.html"
},
{
"name": "Costa Rica",
"size": 55020000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/cs.html"
},
{
"name": "Yemen",
"size": 57970000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ym.html"
},
{
"name": "Slovenia",
"size": 58300000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/si.html"
},
{
"name": "Lebanon",
"size": 61440000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/le.html"
},
{
"name": "Lithuania",
"size": 61600000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/lh.html"
},
{
"name": "Puerto Rico",
"size": 64840000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/rq.html"
},
{
"name": "Tanzania",
"size": 67900000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/tz.html"
},
{
"name": "Kenya",
"size": 71210000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ke.html"
},
{
"name": "Guatemala",
"size": 74840000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/gt.html"
},
{
"name": "Ghana",
"size": 75660000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/gh.html"
}
]
},
{
"name": "group4",
"children": [
{
"name": "Serbia",
"size": 78750000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ri.html"
},
{
"name": "Croatia",
"size": 79300000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/hr.html"
},
{
"name": "Burma",
"size": 82680000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/bm.html"
},
{
"name": "Oman",
"size": 85000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/mu.html"
},
{
"name": "Sudan",
"size": 89160000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/su.html"
},
{
"name": "Azerbaijan",
"size": 93050000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/aj.html"
},
{
"name": "Dominican Republic",
"size": 93380000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/dr.html"
},
{
"name": "Ethiopia",
"size": 94850000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/et.html"
},
{
"name": "Uzbekistan",
"size": 95240000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/uz.html"
},
{
"name": "Tunisia",
"size": 100000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ts.html"
},
{
"name": "Bulgaria",
"size": 101000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/bu.html"
}
]
},
{
"name": "group5",
"children": [
{
"name": "Syria",
"size": 107600000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/sy.html"
},
{
"name": "Cuba",
"size": 114100000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/cu.html"
},
{
"name": "Angola",
"size": 116300000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ao.html"
},
{
"name": "Sri Lanka",
"size": 116300000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ce.html"
},
{
"name": "New Zealand",
"size": 123700000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/nz.html"
},
{
"name": "Slovakia",
"size": 126900000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/lo.html"
},
{
"name": "Ecuador",
"size": 127400000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ec.html"
},
{
"name": "Iraq",
"size": 138800000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/iz.html"
}
]
},
{
"name": "group6",
"children": [
{
"name": "Belarus",
"size": 141800000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/bo.html"
},
{
"name": "Kuwait",
"size": 153500000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ku.html"
},
{
"name": "Morocco",
"size": 163500000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/mo.html"
},
{
"name": "Qatar",
"size": 174900000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/qa.html"
},
{
"name": "Ireland",
"size": 187100000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ei.html"
}
]
},
{
"name": "group7",
"children": [
{
"name": "Finland",
"size": 194300000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/fi.html"
},
{
"name": "Hungary",
"size": 195600000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/hu.html"
},
{
"name": "Denmark",
"size": 206000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/da.html"
},
{
"name": "Kazakhstan",
"size": 216800000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/kz.html"
}
]
},
{
"name": "Israel",
"size": 237000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/is.html"
},
{
"name": "Portugal",
"size": 248500000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/po.html"
},
{
"name": "United Arab Emirates",
"size": 256500000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ae.html"
},
{
"name": "Algeria",
"size": 263300000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ag.html"
},
{
"name": "Norway",
"size": 265500000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/no.html"
},
{
"name": "Romania",
"size": 267100000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ro.html"
},
{
"name": "Bangladesh",
"size": 283500000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/bg.html"
},
{
"name": "Czech Republic",
"size": 285000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ez.html"
},
{
"name": "Greece",
"size": 293900000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/gr.html"
},
{
"name": "Chile",
"size": 299500000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ci.html"
},
{
"name": "Vietnam",
"size": 300000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/vm.html"
},
{
"name": "Peru",
"size": 302000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/pe.html"
},
{
"name": "Singapore",
"size": 314900000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/sn.html"
},
{
"name": "Ukraine",
"size": 329300000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/up.html"
},
{
"name": "Austria",
"size": 349900000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/au.html"
},
{
"name": "Hong Kong",
"size": 351500000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/hk.html"
},
{
"name": "Switzerland",
"size": 353600000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/sz.html"
},
{
"name": "Venezuela",
"size": 374100000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ve.html"
},
{
"name": "Sweden",
"size": 384700000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/sw.html"
},
{
"name": "Philippines",
"size": 391100000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/rp.html"
},
{
"name": "Belgium",
"size": 413700000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/be.html"
},
{
"name": "Nigeria",
"size": 414000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ni.html"
},
{
"name": "Malaysia",
"size": 463700000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/my.html"
},
{
"name": "Colombia",
"size": 471900000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/co.html"
},
{
"name": "Pakistan",
"size": 488400000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/pk.html"
},
{
"name": "Egypt",
"size": 519000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/eg.html"
},
{
"name": "South Africa",
"size": 555000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/sf.html"
},
{
"name": "Thailand",
"size": 602200000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/th.html"
},
{
"name": "Saudi Arabia",
"size": 687700000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/sa.html"
},
{
"name": "Netherlands",
"size": 701400000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/nl.html"
},
{
"name": "Argentina",
"size": 716500000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ar.html"
},
{
"name": "Poland",
"size": 771000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/pl.html"
},
{
"name": "Taiwan",
"size": 875900000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/tw.html"
},
{
"name": "Australia",
"size": 915100000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/as.html"
},
{
"name": "Iran",
"size": 990800000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ir.html"
},
{
"name": "Turkey",
"size": 1075000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/tu.html"
},
{
"name": "Indonesia",
"size": 1125000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/id.html"
},
{
"name": "Canada",
"size": 1395000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ca.html"
},
{
"name": "Spain",
"size": 1406000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/sp.html"
},
{
"name": "Korea, South",
"size": 1554000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ks.html"
},
{
"name": "Mexico",
"size": 1667000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/mx.html"
},
{
"name": "Italy",
"size": 1847000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/it.html"
},
{
"name": "France",
"size": 2214000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/fr.html"
},
{
"name": "United Kingdom",
"size": 2288000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/uk.html"
},
{
"name": "Brazil",
"size": 2294000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/br.html"
},
{
"name": "Russia",
"size": 2383000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/rs.html"
},
{
"name": "Germany",
"size": 3114000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/gm.html"
},
{
"name": "India",
"size": 4421000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/in.html"
},
{
"name": "Japan",
"size": 4444000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ja.html"
},
{
"name": "China",
"size": 11300000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ch.html"
},
{
"name": "United States",
"size": 15080000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/us.html"
},
{
"name": "European Union",
"size": 15480000000000,
"link": "https://www.cia.gov/library/publications/the-world-factbook/geos/ee.html"
}
]
}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<link type="text/css" rel="stylesheet" href="style.css"/>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js"></script>
<style type="text/css">
.chart {
display: block;
margin: auto;
margin-top: 40px;
}
text {
font-size: 11px;
}
rect {
fill: none;
}
</style>
</head>
<body>
<div id="body">
<div id="footer">
GDP (PPP) of countries of the world
<div class="hint">click or option-click to descend or ascend</div>
</div>
</div>
<script type="text/javascript">
var w = 1280 - 80,
h = 800 - 180,
x = d3.scale.linear().range([0, w]),
y = d3.scale.linear().range([0, h]),
color = d3.scale.category20c(),
root,
node;
var treemap = d3.layout.treemap()
.round(false)
.size([w, h])
.sticky(true)
.mode("squarify")
.ratio(1)
.value(function(d) { return d.size; });
var svg = d3.select("#body").append("div")
.attr("class", "chart")
.style("width", w + "px")
.style("height", h + "px")
.append("svg:svg")
.attr("width", w)
.attr("height", h)
.append("svg:g")
.attr("transform", "translate(.5,.5)");
d3.json("area2.json", function(data) {
node = root = data;
var nodes = treemap.nodes(root)
.filter(function(d) { return !d.children; });
var cell = svg.selectAll("g")
.data(nodes)
.enter().append("svg:g")
.attr("class", "cell")
.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; })
.on("click", function(d) {
console.log("node: " + d.name + " parent: " + d.parent.name)
return (node == d.parent ? 0 : zoom(d.parent)); });
cell.append("svg:rect")
.attr("width", function(d) { return d.dx - 1; })
.attr("height", function(d) { return d.dy - 1; })
.style("fill", function(d) { return color(d.parent.name); });
cell.append("a")
.attr("xlink:href", function(d) { return (node == d.parent ? d.link : "javascript: void(0)"); })
.append("svg:text")
.attr("x", function(d) { return d.dx / 2; })
.attr("y", function(d) { return d.dy / 2; })
.attr("dy", ".35em")
.attr("text-anchor", "middle")
.attr("font-family", "sans-serif")
.attr("font-size", "18px")
.text(function(d) { return d.name; })
.style("opacity", function(d) { d.w = this.getComputedTextLength(); return d.dx > d.w ? 1 : 0; });
cell.append("svg:title")
.text(function(d) { return d.name.concat(" : ",numberWithCommas(d.size)); });
d3.select(window).on("click", function() { zoom(root); });
});
function numberWithCommas(x) {
x = x/1000000
return "$".concat(x.toString().replace(/\B(?=(?:\d{3})+(?!\d))/g, ",")," million");
}
function size(d) {
return d.size;
}
function count(d) {
return 1;
}
function zoom(d) {
console.log("zooming " + d.name)
var kx = w / (1 * d.dx), ky = h / (1 * d.dy);
x.domain([d.x, d.x + d.dx]);
y.domain([d.y, d.y + d.dy]);
var t = svg.selectAll("g.cell").transition()
.duration(d3.event.altKey ? 7500 : 750)
.attr("transform", function(d) { return "translate(" + x(d.x) + "," + y(d.y) + ")"; });
t.select("a")
.attr("xlink:href",function(u) {
if (u.parent == d) {
return u.link;
} else {
//console.log("not a child" + u.name);
}
})
t.select("rect")
.attr("width", function(d) { return kx * d.dx - 1; })
.attr("height", function(d) { return ky * d.dy - 1; })
t.select("text")
.attr("x", function(d) { return kx * d.dx / 2; })
.attr("y", function(d) { return ky * d.dy / 2; })
.style("opacity", function(d) { return kx * d.dx > d.w ? 1 : 0; });
node = d;
d3.event.stopPropagation();
}
</script>
</body>
</html>
body {
background: url(texture-noise.png);
overflow: hidden;
margin: 0;
font-size: 14px;
font-family: "Helvetica Neue", Helvetica;
}
#chart, #header, #footer {
position: absolute;
top: 0;
}
#header, #footer {
z-index: 1;
display: block;
font-size: 36px;
font-weight: 300;
text-shadow: 0 1px 0 #fff;
}
#header.inverted, #footer.inverted {
color: #fff;
text-shadow: 0 1px 4px #000;
}
#header {
top: 80px;
left: 140px;
width: 1000px;
}
#footer {
top: 680px;
right: 140px;
text-align: right;
}
rect {
fill: none;
pointer-events: all;
}
pre {
font-size: 18px;
}
line {
stroke: #000;
stroke-width: 1.5px;
}
.string, .regexp {
color: #f39;
}
.keyword {
color: #00c;
}
.comment {
color: #777;
font-style: oblique;
}
.number {
color: #369;
}
.class, .special {
color: #1181B8;
}
a:link, a:visited {
color: #000;
text-decoration: none;
}
a:hover {
color: #666;
}
.hint {
position: absolute;
right: 0;
width: 1280px;
font-size: 12px;
color: #999;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment