Skip to content

Instantly share code, notes, and snippets.

@marijer
Last active October 25, 2017 18:59
Show Gist options
  • Save marijer/30b312300cb9da159a18 to your computer and use it in GitHub Desktop.
Save marijer/30b312300cb9da159a18 to your computer and use it in GitHub Desktop.
Module 2 - Stacked Area Chart
iso2_code iso3_code iso3_digit_code icao_code name continent
AE ARE 784 OM UNITED ARAB EMIRATES ASIA
AF AFG 004 OA AFGHANISTAN ASIA
AG ATG 028 TA ANTIGUA AND BARBUDA SOUTH AMERICA
AI AIA 660 TQ ANGUILLA ISLANDS SOUTH AMERICA
AL ALB 008 LA ALBANIA EUROPE
AM ARM 051 UD ARMENIA ASIA
AN ANT 530 TN NETHERLANDS ANTILLES SOUTH AMERICA
AO AGO 024 FN ANGOLA AFRICA
AR ARG 032 SA ARGENTINA SOUTH AMERICA
AT AUT 040 LO AUSTRIA EUROPE
AU AUS 036 YB AUSTRALIA AUSTRALIA
AU AUS 036 YM AUSTRALIA AUSTRALIA
AZ AZE 031 UB AZERBAIJAN ASIA
BA BIH 070 LQ BOSNIA AND HERZEGOVINA EUROPE
BB BRB 052 TB BARBADOS SOUTH AMERICA
BD BGD 050 VG BANGLADESH ASIA
BE BEL 056 EB BELGIUM EUROPE
BF BFA 854 DF BURKINA FASO AFRICA
BG BGR 100 LB BULGARIA EUROPE
BH BHR 048 OB BAHRAIN ASIA
BI BDI 108 HB BURUNDI AFRICA
BJ BEN 204 DB BENIN AFRICA
BM BMU 060 TX BERMUDA SOUTH AMERICA
BN BRN 096 WB BRUNEI DARUSSALAM ASIA
BO BOL 068 SL BOLIVIA SOUTH AMERICA
BR BRA 076 SB BRASIL SOUTH AMERICA
BR BRA 076 SD BRASIL SOUTH AMERICA
BR BRA 076 SN BRASIL SOUTH AMERICA
BR BRA 076 SS BRASIL SOUTH AMERICA
BR BRA 076 SW BRASIL SOUTH AMERICA
BS BHS 044 MY BAHAMAS SOUTH AMERICA
BT BTN 064 VQ BHUTAN ASIA
BW BWA 072 FB BOTSWANA AFRICA
BY BLR 112 UM BELARUS EUROPE
BZ BLZ 084 MZ BELIZE SOUTH AMERICA
CA CAN 124 CY CANADA NORTH AMERICA
CA CAN 124 CZ CANADA NORTH AMERICA
CD COD 180 FZ DEMOCRATIC REPUBLIC OF CONGO AFRICA
CF CAF 140 FE CENTRAL AFRICAN REPUBLIC AFRICA
CG COG 178 FC CONGO AFRICA
CH CHE 756 LS SWITZERLAND EUROPE
CI CIV 384 DI IVORY COAST AFRICA
CI CIV 384 LX GIBRALTAR (UK) EUROPE
CK COK 184 NC COOK ISLANDS AUSTRALIA
CL CHL 152 SC CHILE, EASTER ISLANDS SOUTH AMERICA
CM CMR 120 FK CAMEROON AFRICA
CN CHN 156 ZB CHINA ASIA
CN CHN 156 ZG CHINA ASIA
CN CHN 156 ZH CHINA ASIA
CN CHN 156 ZJ CHINA ASIA
CN CHN 156 ZL CHINA ASIA
CN CHN 156 ZP CHINA ASIA
CN CHN 156 ZS CHINA ASIA
CN CHN 156 ZU CHINA ASIA
CN CHN 156 ZW CHINA ASIA
CN CHN 156 ZY CHINA ASIA
CN CHN 156 ZZ TAHITI LIMA PACIFIC
CO COL 170 SK COLOMBIA SOUTH AMERICA
CR CRI 188 MR COSTA RICA SOUTH AMERICA
CU CUB 192 MU CUBA SOUTH AMERICA
CV CPV 132 GV CAPE VERDE AFRICA
CY CYP 196 LC CYPRUS EUROPE
CZ CZE 203 LK CZECH REPUBLIC EUROPE
DE DEU 276 ED GERMANY, FEDERAL REPUBLIC OF EUROPE
DE DEU 276 ET GERMANY, FEDERAL REPUBLIC OF EUROPE
DJ DJI 262 HD DJIBOUTI AFRICA
DK DNK 208 EK DENMARK EUROPE
DM DMA 212 TD DOMINICA SOUTH AMERICA
DO DOM 214 MD DOMINICAN REPUBLIC SOUTH AMERICA
DZ DZA 012 DA ALGERIA AFRICA
EC ECU 218 SE ECUADOR SOUTH AMERICA
EE EST 233 EE ESTONIA EUROPE
EG EGY 818 HE EGYPT AFRICA
ER ERI 232 HH ERITREA AFRICA
ES ESP 724 GC CANARY ISLANDS (SPAIN) AFRICA
ES ESP 724 LE SPAIN EUROPE
ET ETH 231 HA ETHIOPIA AFRICA
FI FIN 246 EF FINLAND EUROPE
FJ FJI 242 NF FIJI AUSTRALIA
FK FLK 238 SF FALKLAND ISLANDS SOUTH AMERICA
FM FSM 583 PT MICRONESIA PACIFIC
FR FRA 250 LF FRANCE EUROPE
FR FRA 250 TF FRENCH ANTILLES SOUTH AMERICA
GA GAB 266 FO GABON AFRICA
GB GBR 826 EG UNITED KINGDOM EUROPE
GB GBR 826 FH ASCENSION ISLANDS AFRICA
GD GRD 308 TG GRENADA SOUTH AMERICA
GE GEO 268 UG GEORGIA ASIA
GF GUF 254 SO FRENCH GUYANA SOUTH AMERICA
GH GHA 288 DG GHANA AFRICA
GL GRL 304 BG GREENLAND (DENMARK) ARCTIC
GM GMB 270 GB GAMBIA AFRICA
GN GIN 324 GU GUINEA, REPUBLIC OF AFRICA
GQ GNQ 226 FG GUINEA EQUATORIAL AFRICA
GR GRC 300 LG GREECE EUROPE
GT GTM 320 MG GUATEMALA SOUTH AMERICA
GW GNB 624 GG GUINEA BISSAU AFRICA
GY GUY 328 SY GUYANA SOUTH AMERICA
HK HKG 344 VH HONG KONG ASIA
HN HND 340 MH HONDURAS SOUTH AMERICA
HR HRV 191 LD CROATIA EUROPE
HT HTI 332 MT HAITI SOUTH AMERICA
HU HUN 348 LH HUNGARY EUROPE
ID IDN 360 WA INDONESIA ASIA
ID IDN 360 WI INDONESIA ASIA
ID IDN 360 WR INDONESIA ASIA
IE IRL 372 EI IRELAND EUROPE
IL ISR 376 LL ISRAEL ASIA
IN IND 356 VA INDIA ASIA
IN IND 356 VE INDIA ASIA
IN IND 356 VI INDIA ASIA
IN IND 356 VO INDIA ASIA
IO IOT 086 FJ BRITISH INDIAN OCEAN TERRITORY AFRICA
IQ IRQ 368 OR IRAQ ASIA
IR IRN 364 OI IRAN, ISLAMIC REPUBLIC ASIA
IS ISL 352 BI ICELAND EUROPE
IT ITA 380 LI ITALY EUROPE
JM JAM 388 MK JAMAICA, GRANADA AND SANTA LUCIA SOUTH AMERICA
JO JOR 400 OJ JORDAN ASIA
JP JPN 392 RJ JAPAN ASIA
JP JPN 392 RO JAPAN (RYUKYU ISLANDS) ASIA
KE KEN 404 HK KENYA AFRICA
KH KHM 116 VD CAMBODIA ASIA
KI KIR 296 NG KIRIBATI AND TUVALU AUSTRALIA
KI KIR 296 PC PHOENIX ISLANDS (UK) KIRIBATI PACIFIC
KI KIR 296 PL LINE ISLANDS AND KIRIBATI PACIFIC
KN KNA 659 TK ST. KITTS AND NEVIS SOUTH AMERICA
KP PRK 408 ZK KOREA, DEMOCRATIC PEOPLES REPUBLIC ASIA
KR KOR 410 RK KOREA, REPUBLIC OF ASIA
KW KWT 414 OK KUWAIT ASIA
KY CYM 136 MW CAYMAN ISLANDS SOUTH AMERICA
KZ KAZ 398 UA KAZAKHSTAN ASIA
LA LAO 418 VL LAOS PEOPLES DEMOCRATIC REPUBLIC ASIA
LC LCA 662 TL SAINT LUCIA SOUTH AMERICA
LK LKA 144 VC SRI LANKA ASIA
LP LBN 422 OL LEBANON ASIA
LR LBR 430 GL LIBERIA AFRICA
LS LSO 426 FX LESOTHO AFRICA
LT LTU 440 EY LITHUANIA EUROPE
LU LUX 442 EL LUXEMBOURG EUROPE
LV LVA 428 EV LATVIA EUROPE
LY LBY 434 HL LIBYAN ARAB JAMAHIRIYA AFRICA
MA MAR 504 GM MOROCCO AFRICA
MD MDA 498 LU MOLDOVA EUROPE
MG MDG 450 FM MADAGASCAR/COMOROS AFRICA
MH MHL 584 PK MARSHALL ISLANDS PACIFIC
MK MKD 807 LW REPUBLIC OF MACEDONIA EUROPE
ML MLI 466 GA MALI AFRICA
MM MMR 104 VY MYANMAR ASIA
MN MNG 496 ZM MONGOLIA ASIA
MO MAC 446 VM MACAU ASIA
MR MRT 478 GQ MAURITANIA AFRICA
MS MSR 500 TR MONTSERRAT ISLANDS SOUTH AMERICA
MT MLT 470 LM MALTA EUROPE
MU MUS 480 FI MAURITIUS AFRICA
MV MDV 462 VR MALDIVES ASIA
MW MWI 454 FW MALAWI AFRICA
MX MEX 484 MM MEXICO SOUTH AMERICA
MY MYS 458 WM MALAYSIA ASIA
MZ MOZ 508 FQ MOZAMBIQUE AFRICA
NA NAM 516 FY NAMIBIA AFRICA
NC NCL 540 NW NEW CALEDONIA AUSTRALIA
NE NER 562 DR NIGER AFRICA
NG NGA 566 DN NIGERIA AFRICA
NI NIC 558 MN NICARAGUA SOUTH AMERICA
NL NLD 528 EH NETHERLANDS EUROPE
NO NOR 578 EN NORWAY EUROPE
NP NPL 524 VN NEPAL ASIA
NR NRU 520 AN NAURU PACIFIC
NU NIU 570 NI NIUE ISLANDS AUSTRALIA
NZ NZL 554 NZ NEW ZEALAND PACIFIC
OM OMN 512 OO OMAN ASIA
PA PAN 591 MP PANAMA SOUTH AMERICA
PE PER 604 SP PERU SOUTH AMERICA
PF PYF 258 NT FRENCH POLYNESIA AUSTRALIA
PG PNG 598 AY PAPUA NEW GUINEA PACIFIC
PH PHL 608 RP PHILIPPINES ASIA
PK PAK 586 OP PAKISTAN ASIA
PL POL 616 EP POLAND EUROPE
PR PRI 630 TJ UNITED STATES / PUERTO RICO SOUTH AMERICA
PT PRT 620 LP PORTUGAL, MADEIRA AND AZORES EUROPE
PY PRY 600 SG PARAGUAY SOUTH AMERICA
QA QAT 634 OT QATAR ASIA
RO ROM 642 LR ROMANIA EUROPE
RS UNK 688 BK KOSOVO EUROPE
RU RUS 643 UE CIS/RUSSIAN FEDERATION ASIA
RU RUS 643 UH CIS/RUSSIAN FEDERATION ASIA
RU RUS 643 UI CIS/RUSSIAN FEDERATION ASIA
RU RUS 643 UL CIS/RUSSIAN FEDERATION ASIA
RU RUS 643 UN CIS/RUSSIAN FEDERATION ASIA
RU RUS 643 UO CIS/RUSSIAN FEDERATION ASIA
RU RUS 643 UR CIS/RUSSIAN FEDERATION ASIA
RU RUS 643 US CIS/RUSSIAN FEDERATION ASIA
RU RUS 643 UU CIS/RUSSIAN FEDERATION EUROPE
RU RUS 643 UW CIS/RUSSIAN FEDERATION ASIA
RW RWA 646 HR RWANDA AFRICA
SA SAU 682 OE SAUDI ARABIA ASIA
SB SLB 090 AG SOLOMON ISLANDS PACIFIC
SB SLB 090 LY SERBIA-MONTENEGRO EUROPE
SC SYC 690 FS SEYCHELLES AFRICA
SD SDN 736 HS SUDAN AFRICA
SE SWE 752 ES SWEDEN EUROPE
SG SGP 702 WS SINGAPORE ASIA
SI SVN 705 LJ SLOVENIA EUROPE
SK SVK 703 LZ SLOVAKIAN REPUBLIC EUROPE
SL SLE 694 GF SIERRA LEONE AFRICA
SN SEN 686 GO SENEGAL AFRICA
SO SOM 706 HC SOMALIA AFRICA
SR SUR 740 SM SURINAME SOUTH AMERICA
ST STP 678 FP SAO TOME AND PRINCIPE AFRICA
SV SLV 222 MS EL SALVADOR SOUTH AMERICA
SY SYR 760 OS SYRIAN ARAB REPUBLIC ASIA
SZ SWZ 748 FD SWAZILAND AFRICA
TC TCA 796 MB TURKS AND CAICOS ISLANDS SOUTH AMERICA
TD TCD 148 FT CHAD AFRICA
TG TGO 768 DX TOGO AFRICA
TH THA 764 VT THAILAND ASIA
TL TLS 626 WP EAST TIMOR ASIA
TN TUN 788 DT TUNISIA AFRICA
TR TUR 792 LT TURKEY EUROPE
TT TTO 780 TT TRINIDAD AND TOBAGO SOUTH AMERICA
TW TWN 158 RC TAIWAN ASIA
TZ TZA 834 HT TANZANIA, UNITED REPUBLIC OF AFRICA
UA UKR 804 UK UKRAINE EUROPE
UG UGA 800 HU UGANDA AFRICA
UM UMI 581 PJ JOHNSTON ISLANDS (US)EXTERNAL PACIFIC
UM UMI 581 PM MIDWAY ISLANDS (US)EXTERNAL PACIFIC
UM UMI 581 PW WAKE ISLANDS (US)EXTERNAL PACIFIC
US USA 840 K1 UNITED STATES NORTH AMERICA
US USA 840 K2 UNITED STATES NORTH AMERICA
US USA 840 K3 UNITED STATES NORTH AMERICA
US USA 840 K4 UNITED STATES NORTH AMERICA
US USA 840 K5 UNITED STATES NORTH AMERICA
US USA 840 K6 UNITED STATES NORTH AMERICA
US USA 840 K7 UNITED STATES NORTH AMERICA
US USA 840 KZ UNITED STATES NORTH AMERICA
US USA 840 PA UNITED STATES / ALASKA NORTH AMERICA
US USA 840 PB BAKER ISLANDS PACIFIC
US USA 840 PG MARIANA ISLANDS PACIFIC
US USA 840 PH UNITED STATES / HAWAII PACIFIC
UY URY 858 SU URUGUAY SOUTH AMERICA
UZ UZB 860 UT UZBEKISTAN ASIA
VC VCT 670 TV ST. VINCENT AND GRENADINES SOUTH AMERICA
VE VEN 862 SV VENEZUELA SOUTH AMERICA
VG VGB 092 TU VIRGIN ISLANDS (UK) SOUTH AMERICA
VI VIR 850 TI VIRGIN ISLANDS (US) SOUTH AMERICA
VN VNM 704 VV VIETNAM ASIA
VU VUT 548 NV VANUATU AUSTRALIA
WF WLF 876 NL WALLIS ISLANDS AND FUTUNA AUSTRALIA
WS WSM 882 NS SAMOA/AMERICAN SAMOA AUSTRALIA
YE YEM 887 OY YEMEN REPUBLIC ASIA
ZA ZAF 710 FA SOUTH AFRICA AFRICA
ZM ZMB 894 FL ZAMBIA AFRICA
ZW ZWE 716 FV ZIMBABWE AFRICA
Country Code Indicator_Name Indicator_Code 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015
Aruba ABW Refugee population by country or territory of origin SM.POP.REFG.OR
Andorra AND Refugee population by country or territory of origin SM.POP.REFG.OR 2 2 3 1 2 3 2 1 10 10 3 9 10 9 6 6 6 6 7 5 7
Afghanistan AFG Refugee population by country or territory of origin SM.POP.REFG.OR 6339095 6306301 4552153 3374576 2731169 2679133 2674236 2676674 2667115 2601691 3587336 3809767 2510294 2136043 2414401 2166149 2107519 3057661 2833128 2887123 3054709 2664436 2586152 2556556 2593368
Angola AGO Refugee population by country or territory of origin SM.POP.REFG.OR 407760 381636 300492 323831 282577 246657 249687 267696 319430 353478 433760 470625 435421 329583 228838 215827 206501 186155 171393 141021 134858 128664 19258 10297 9507
Albania ALB Refugee population by country or territory of origin SM.POP.REFG.OR 1822 3540 4353 4744 5019 5803 5785 5379 5353 6288 6802 7626 10761 10385 10470 12722 14080 15340 15006 15711 14772 13551 12568 10084 10140
Arab World ARB Refugee population by country or territory of origin SM.POP.REFG.OR 2212498 2408680 2614885 1906599 2001784 2005056 2035564 1864336 1806135 1817001 1672735 1873008 1896002 1831115 1880608 1797793 3023683 3722824 3328247 3029306 3034372 3205416 3359110 4804793 6171232
United Arab Emirates ARE Refugee population by country or territory of origin SM.POP.REFG.OR 4 7 7 15 18 31 20 71 30 265 308 256 414 424 486 584 90 90
Argentina ARG Refugee population by country or territory of origin SM.POP.REFG.OR 334 198 113 98 469 330 217 159 142 586 609 659 771 784 796 856 894 1171 1047 608 557 518 447 388 318
Armenia ARM Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 195003 200116 201842 201442 203231 203690 193150 193231 5786 7207 13249 13162 13424 13965 14918 15436 16336 18000 17547 16487 15935 12021 11850
American Samoa ASM Refugee population by country or territory of origin SM.POP.REFG.OR
Antigua and Barbuda ATG Refugee population by country or territory of origin SM.POP.REFG.OR 1 2 2 1 4 5 5 13 13 19 25 26 28 30 32 45 49 53
Australia AUS Refugee population by country or territory of origin SM.POP.REFG.OR 2 1 1 2 1 3 3 1 10 15 13 44 29 63 43 28 37 39 48 28 25
Austria AUT Refugee population by country or territory of origin SM.POP.REFG.OR 60 49 52 55 60 48 35 29 72 66 47 66 34 23 14 12 10 11 12 10 10
Azerbaijan AZE Refugee population by country or territory of origin SM.POP.REFG.OR 300000 328005 299095 200520 236086 234950 329657 311131 284277 268759 260214 253255 250583 233675 126068 15916 16319 16939 16753 16162 15537 10813 10521
Burundi BDI Refugee population by country or territory of origin SM.POP.REFG.OR 191622 223946 184135 871382 389706 350582 428680 519123 502568 527449 568084 553999 574557 531637 485773 438706 396541 375727 281592 94239 84064 101288 73363 72652 72499
Belgium BEL Refugee population by country or territory of origin SM.POP.REFG.OR 2 3 5 10 14 16 19 13 27 40 45 95 64 60 61 71 83 90 93 78 75
Benin BEN Refugee population by country or territory of origin SM.POP.REFG.OR 2 4 4 68 77 54 46 46 56 52 54 55 232 282 309 411 215 271 318 411 442 461 457 305 340
Burkina Faso BFA Refugee population by country or territory of origin SM.POP.REFG.OR 2 8 61 63 67 63 72 118 103 106 130 98 978 853 583 607 376 558 725 990 1145 1271 1460 1688 1853
Bangladesh BGD Refugee population by country or territory of origin SM.POP.REFG.OR 477 611 53921 57158 56199 56956 57959 44373 4658 4468 5401 5548 5808 5565 5731 7304 7803 10243 10098 10432 10049 10056 10161 9839 10865
Bulgaria BGR Refugee population by country or territory of origin SM.POP.REFG.OR 1922 2735 2981 3155 4689 4156 3246 3048 3122 2653 2404 2121 2841 2567 2215 4254 3438 3311 3040 2745 2559 2327 2147 1880 1648
Bahrain BHR Refugee population by country or territory of origin SM.POP.REFG.OR 39 52 53 60 75 71 63 82 97 129 95 46 50 52 52 41 62 73 80 79 87 215 297 275 347
Bahamas, The BHS Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 1 1 1 1 1 14 14 15 15 17 185 196 210 215
Bosnia and Herzegovina BIH Refugee population by country or territory of origin SM.POP.REFG.OR 437501 618427 776084 769753 993868 849241 640075 598193 504981 447321 406448 300006 228831 109930 199946 78273 74366 70018 63004 58578 51822 26811 21845
Belarus BLR Refugee population by country or territory of origin SM.POP.REFG.OR 2 37 84 501 303 290 1507 2519 3696 6364 7815 8244 8857 9371 4970 5384 5525 5743 5925 6191 4444 4302
Belize BLZ Refugee population by country or territory of origin SM.POP.REFG.OR 8 8 3 11 12 1 10 9 8 18 17 20 17 23 32 39 40 45
Bermuda BMU Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 1 1 1 2 0
Bolivia BOL Refugee population by country or territory of origin SM.POP.REFG.OR 731 67 28 41 177 180 177 161 183 174 175 156 219 264 285 269 374 428 454 573 590 611 618 601 599
Brazil BRA Refugee population by country or territory of origin SM.POP.REFG.OR 14 11 11 12 41 53 85 104 136 196 224 254 441 378 403 370 707 1624 1404 973 994 1045 1076 986 977
Barbados BRB Refugee population by country or territory of origin SM.POP.REFG.OR 4 3 2 3 5 4 8 7 9 11 7 8 27 38 34 29 32 45 55 67 86
Brunei Darussalam BRN Refugee population by country or territory of origin SM.POP.REFG.OR 3 2 1 1 49 2 2 1 1 1 1 1 1 1
Bhutan BTN Refugee population by country or territory of origin SM.POP.REFG.OR 9504 75442 85334 103271 104750 106822 108703 105689 107619 108945 110845 112523 103978 105255 106537 108073 110598 104965 89070 75070 57989 41590 31567 23642
Botswana BWA Refugee population by country or territory of origin SM.POP.REFG.OR 3 3 3 4 21 25 23 17 16 10 3 2 5 5 6 4 12 16 26 30 53 85 127 168 237
Central African Republic CAF Refugee population by country or territory of origin SM.POP.REFG.OR 100 320 325 313 266 242 240 149 173 196 139 28704 25376 35400 31069 42890 71685 98104 125106 159554 164905 162862 164568 252865 410787
Canada CAN Refugee population by country or territory of origin SM.POP.REFG.OR 4 4 4 4 4 8 11 15 18 26 4 51 60 56 122 95 530 101 99 90 109 123 100 95
Central Europe and the Baltics CEB Refugee population by country or territory of origin SM.POP.REFG.OR 90730 60785 218579 230375 163574 304331 349489 379281 362720 373495 351757 306045 320685 273473 247938 167220 128701 118509 112055 90157 78037 73982 72791 58765 48680
Switzerland CHE Refugee population by country or territory of origin SM.POP.REFG.OR 8 27 33 55 77 91 70 61 56 35 12 16 36 31 32 18 19 20 17 15 19
Channel Islands CHI Refugee population by country or territory of origin SM.POP.REFG.OR
Chile CHL Refugee population by country or territory of origin SM.POP.REFG.OR 14548 14007 14043 15267 15474 14273 12805 9776 7011 1543 860 834 1709 1555 1194 938 805 970 994 1312 1170 1189 1152 596 579
China CHN Refugee population by country or territory of origin SM.POP.REFG.OR 1426 2011 82576 111509 113907 104693 105810 106738 109402 111952 110975 117409 132115 132406 134724 124101 140598 149095 175180 180558 184602 190369 193453 195137 210730
Cote d'Ivoire CIV Refugee population by country or territory of origin SM.POP.REFG.OR 2 13 34 41 98 201 268 360 537 562 773 858 23741 33637 23655 18338 26315 22232 22227 23153 41758 154824 100720 85729 71959
Cameroon CMR Refugee population by country or territory of origin SM.POP.REFG.OR 100 1 83 173 238 2017 2109 2258 1348 1654 2062 2724 5225 6206 7629 9101 10384 11508 13870 14766 14963 15163 13382 11442 10761
Congo, Rep. COG Refugee population by country or territory of origin SM.POP.REFG.OR 2 4 7 11 32 177 221 21147 17143 27302 27579 24237 28002 28958 28152 24438 20609 19735 19925 20544 20679 12839 12119 11751 14497
Colombia COL Refugee population by country or territory of origin SM.POP.REFG.OR 494 740 843 1042 1363 1902 2168 2377 3538 4413 9279 17938 30625 37995 47381 60450 72796 551744 373532 389753 395577 395949 394117 396635 103150
Comoros COM Refugee population by country or territory of origin SM.POP.REFG.OR 4 2 2 2 5 10 13 10 33 31 28 26 43 58 50 61 72 96 378 268 368 422 454 515 581
Cabo Verde CPV Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 1 1 2 2 1 2 2 4 8 9 8 5 40 32 30 24 25 27 25 27 27
Costa Rica CRI Refugee population by country or territory of origin SM.POP.REFG.OR 1 5 5 223 211 139 90 54 76 57 86 98 92 138 178 284 361 354 344 352 331 325 462 417
Caribbean small states CSS Refugee population by country or territory of origin SM.POP.REFG.OR 6627 5927 2549 901 1028 929 875 776 643 620 538 471 522 688 1006 1608 2297 3041 3320 3563 3872 4576 5155 5655 6221
Cuba CUB Refugee population by country or territory of origin SM.POP.REFG.OR 13523 17615 21273 22406 23316 24854 25462 24913 23559 23328 20084 18959 18043 16093 15659 19000 33580 7503 7938 7549 7477 7856 7731 7428 6502
Curacao CUW Refugee population by country or territory of origin SM.POP.REFG.OR 35 35
Cayman Islands CYM Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 1 6 6
Cyprus CYP Refugee population by country or territory of origin SM.POP.REFG.OR 11 6 9 10 8 11 16 11 5 7 5 2 5 5 9 10 11 13 11 11 10 10
Czech Republic CZE Refugee population by country or territory of origin SM.POP.REFG.OR 6123 4491 3327 5015 4648 2039 977 698 1934 1243 810 1179 6984 6702 4542 3589 2138 1384 1358 1067 817 763 622 991 1328
Germany DEU Refugee population by country or territory of origin SM.POP.REFG.OR 4 4 8 449 386 420 443 688 1298 1183 1033 928 725 78 78 114 129 166 170 164 174 182 175 176
Djibouti DJI Refugee population by country or territory of origin SM.POP.REFG.OR 5 10 11 38 18068 18095 18101 8142 3219 1879 1910 452 471 522 495 504 486 648 650 622 566 602 640 762 880
Dominica DMA Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 1 3 2 5 6 17 25 30 49 58 56 53 52 52 54 43 38
Denmark DNK Refugee population by country or territory of origin SM.POP.REFG.OR 11 18 34 33 28 25 25 3 8 10 10 12 12 14 11 10 9 9 9 10 12
Dominican Republic DOM Refugee population by country or territory of origin SM.POP.REFG.OR 1 29 30 29 47 42 45 47 46 83 92 97 67 150 358 318 230 246 250 289 306 349
Algeria DZA Refugee population by country or territory of origin SM.POP.REFG.OR 19 55 71 86 20743 1520 2247 3418 5727 7151 8034 8418 12107 11667 10691 12041 8353 10615 9060 8185 6689 6121 5677 3662 3523
East Asia & Pacific (developing only) EAP Refugee population by country or territory of origin SM.POP.REFG.OR 694681 712095 976759 1013131 930497 932862 891041 870786 839464 926539 849428 792396 784817 707877 711122 727807 804961 724623 740993 976628 987173 988923 990050 1031242 784268
East Asia & Pacific (all income levels) EAS Refugee population by country or territory of origin SM.POP.REFG.OR 694681 712100 976767 1013141 930793 933113 891211 870911 839599 926666 849550 792516 785154 708209 711496 728234 806634 726546 742465 977491 988066 989763 990937 1032036 785144
Europe & Central Asia (developing only) ECA Refugee population by country or territory of origin SM.POP.REFG.OR 62280 85728 1125173 1331204 1485982 1404450 1919843 1736179 1525385 1489503 1121139 1057615 1430706 1277947 1118804 938988 886435 592205 605831 545614 524012 491709 473645 210653 431682
Europe & Central Asia (all income levels) ECS Refugee population by country or territory of origin SM.POP.REFG.OR 217570 272188 1529462 1778178 1875046 1895785 2429552 2303118 2048277 1882131 1505321 1402154 1833432 1638730 1467649 1195146 1167145 796240 814013 738922 708333 670594 652979 340473 550506
Ecuador ECU Refugee population by country or territory of origin SM.POP.REFG.OR 3 27 40 47 174 206 221 217 512 496 671 653 822 730 727 775 887 1332 1066 1027 852 909 844 707 805
Egypt, Arab Rep. EGY Refugee population by country or territory of origin SM.POP.REFG.OR 48 97 209 258 502 872 1202 1722 2612 3491 3953 4678 6443 5735 5376 6291 7613 6799 6780 6990 6913 7936 10020 12834 15873
Euro area EMU Refugee population by country or territory of origin SM.POP.REFG.OR 32 17 78 28551 16223 14473 8800 8703 6780 7053 6254 3606 8789 8617 7216 6959 8536 2429 2494 2502 2272 2417 2574 1861 1806
Eritrea ERI Refugee population by country or territory of origin SM.POP.REFG.OR 43 500633 503200 427213 422433 286712 332225 319077 346781 347138 376851 333229 318176 124121 131131 144066 193745 208748 186398 209168 222460 251954 285371 308022 330526
Spain ESP Refugee population by country or territory of origin SM.POP.REFG.OR 42 36 218 215 60 53 80 48 58 53 49 49 2444 41 27 34 42 43 52 56 60
Estonia EST Refugee population by country or territory of origin SM.POP.REFG.OR 2 59 95 297 351 1310 1266 792 633 455 479 1060 1027 855 743 626 262 248 248 240 224 456 352 339
Ethiopia ETH Refugee population by country or territory of origin SM.POP.REFG.OR 1345928 251241 313129 251828 226436 100987 96270 84401 70680 71055 66410 58997 61240 62677 63150 65461 74026 59858 63878 62889 68848 70610 74968 77118 86861
European Union EUU Refugee population by country or territory of origin SM.POP.REFG.OR 90759 60797 218587 230389 164633 305418 351079 380822 364129 375439 353554 307498 322708 275259 248973 168834 131946 119385 112876 90931 78832 74820 73665 59639 49577
Fragile and conflict affected situations FCS Refugee population by country or territory of origin SM.POP.REFG.OR 9672159 10375499 9457971 9112787 8130856 7595937 7974292 7371941 7033449 7256269 8033366 8095140 6786304 6046393 6227391 5654397 6867590 8309480 7555642 7484632 7707547 7644049 7873171 9441393 11215988
Finland FIN Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 2 6 6 5 2 9 7 3 5 6 4 4 6 6 7 7 8 7
Fiji FJI Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 19 89 156 222 305 326 301 328 401 731 1072 1087 1281 1379 1685 1828 1868 1892 1851 1579 1317 1112 924
France FRA Refugee population by country or territory of origin SM.POP.REFG.OR 20 15 44 61 64 63 78 44 90 110 110 286 82 101 101 87 92 99 100 98 92
Faeroe Islands FRO Refugee population by country or territory of origin SM.POP.REFG.OR
Micronesia, Fed. Sts. FSM Refugee population by country or territory of origin SM.POP.REFG.OR
Gabon GAB Refugee population by country or territory of origin SM.POP.REFG.OR 17 18 22 25 24 19 28 26 26 27 37 39 53 81 95 116 129 144 165 173 183 177 172
United Kingdom GBR Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 1 2 108 77 73 79 92 106 113 109 164 149 144 135 174 201 185 156 153 150 153 142 141
Georgia GEO Refugee population by country or territory of origin SM.POP.REFG.OR 6012 5117 308 48489 47164 35669 29878 21821 17498 16975 12497 6633 7301 6340 11810 12598 15020 10640 10112 9261 6772 6732
Ghana GHA Refugee population by country or territory of origin SM.POP.REFG.OR 4691 4701 4776 4473 14289 13592 15095 14775 13633 13293 14775 14556 15686 15879 14767 18433 9960 5063 13242 14893 20203 20361 24298 21378 22147
Guinea GIN Refugee population by country or territory of origin SM.POP.REFG.OR 2 19 31 106 441 523 648 924 1151 1497 2019 3418 3871 4782 5820 6840 8278 9495 10920 11985 13161 14061 14594 15243
Gambia, The GMB Refugee population by country or territory of origin SM.POP.REFG.OR 4 15 24 26 30 161 310 421 570 677 750 734 861 746 684 1683 1254 1267 1352 1973 2242 2583 3076 3434 5134
Guinea-Bissau GNB Refugee population by country or territory of origin SM.POP.REFG.OR 5003 5006 5008 5011 5015 830 856 868 8887 3185 886 927 986 975 1018 1050 1004 1028 1065 1109 1127 1123 1180 1236 1307
Equatorial Guinea GNQ Refugee population by country or territory of origin SM.POP.REFG.OR 60 114 214 342 343 397 473 420 429 509 529 552 591 552 477 461 407 384 344 305 258 228 200 174
Greece GRC Refugee population by country or territory of origin SM.POP.REFG.OR 16 6 1 1 94 222 250 178 174 164 125 97 301 270 224 331 91 92 67 62 51 56 51 92 113
Grenada GRD Refugee population by country or territory of origin SM.POP.REFG.OR 4 4 1 3 6 11 12 20 36 24 53 73 77 99 152 202 297 312 333 345 323 316 330 324
Greenland GRL Refugee population by country or territory of origin SM.POP.REFG.OR
Guatemala GTM Refugee population by country or territory of origin SM.POP.REFG.OR 47988 52587 53941 50267 49610 42899 40342 37508 32747 28082 20711 16867 13888 6696 4376 3379 6496 6161 5934 5768 5679 6088 6388 6615 7483
Guam GUM Refugee population by country or territory of origin SM.POP.REFG.OR
Guyana GUY Refugee population by country or territory of origin SM.POP.REFG.OR 2 1 2 4 71 62 55 38 41 49 36 36 49 78 194 406 537 677 708 727 749 771 801 800 700
High income HIC Refugee population by country or territory of origin SM.POP.REFG.OR 171176 201542 419237 463179 409290 509970 526706 580612 533566 397909 388381 348632 408711 366829 355150 263783 292825 220382 224219 209192 201289 198025 200122 148977 137900
Hong Kong SAR, China HKG Refugee population by country or territory of origin SM.POP.REFG.OR 2 2 261 205 105 50 42 20 13 7 5 9 8 10 11 11 12 17 15 19 25 25
Honduras HND Refugee population by country or territory of origin SM.POP.REFG.OR 18 21 41 448 1214 1219 1259 1246 1101 1070 903 781 673 604 484 535 1035 1236 1116 1166 1302 1966 2613 3301 4159
Heavily indebted poor countries (HIPC) HPC Refugee population by country or territory of origin SM.POP.REFG.OR 11718367 11131022 9715002 9404615 9204934 8084004 6803655 5976490 5785370 5885135 6925266 6804592 5578968 5094361 5379960 5022784 4931689 5608025 5273912 5390666 5709872 5893051 6008109 6118515 6292503
Croatia HRV Refugee population by country or territory of origin SM.POP.REFG.OR 168571 151688 76256 245572 310088 349307 338089 353725 335199 290279 274818 230189 215475 119148 93767 100423 97012 76478 65861 62649 62606 49760 40126
Haiti HTI Refugee population by country or territory of origin SM.POP.REFG.OR 2092 1858 2486 3866 9803 13925 15118 15481 13538 8766 7561 7248 7718 7547 9208 13542 20837 22280 23066 24116 25892 33661 38568 38660 37161
Hungary HUN Refugee population by country or territory of origin SM.POP.REFG.OR 5767 4733 3993 5016 4471 2348 3083 2669 1242 800 518 953 3517 3395 2749 3519 3118 3386 1614 1537 1438 1238 1087 1220 1267
Indonesia IDN Refugee population by country or territory of origin SM.POP.REFG.OR 7169 6164 6829 7924 8726 9836 11365 8799 9053 9020 9149 8970 9906 16240 27919 34384 34728 20558 19345 18213 16892 16079 15523 14786 9562
Isle of Man IMN Refugee population by country or territory of origin SM.POP.REFG.OR
India IND Refugee population by country or territory of origin SM.POP.REFG.OR 198 408 1019 1492 3263 5011 7550 8924 9663 9845 11399 11571 14349 13706 13345 16285 17811 20466 19569 19514 17769 16232 14258 11042 10433
Not classified INX Refugee population by country or territory of origin SM.POP.REFG.OR
Ireland IRL Refugee population by country or territory of origin SM.POP.REFG.OR 3 2 2 1 3 3 7 6 3 21 4 10 7 7 8 8 9 9 10
Iran, Islamic Rep. IRN Refugee population by country or territory of origin SM.POP.REFG.OR 75889 130366 128781 115523 121287 112364 104129 93993 89979 86855 88278 92491 138364 122530 115162 99428 102483 68397 69061 72774 68791 72361 75940 75043 82170
Iraq IRQ Refugee population by country or territory of origin SM.POP.REFG.OR 1133805 1321853 1343824 771077 749834 718719 714730 707338 675030 642886 526179 530511 422512 368580 311884 262299 1450905 2309245 1903519 1785212 1683579 1428308 746206 401417 369904
Iceland ISL Refugee population by country or territory of origin SM.POP.REFG.OR 4 5 5 5 5 13 12 10 7 31 7 7 4 4 3 3 2 1
Israel ISR Refugee population by country or territory of origin SM.POP.REFG.OR 16 28 40 118 887 937 1126 987 835 478 416 363 564 625 672 632 882 1541 1494 1310 1301 1335 1340 1043 971
Italy ITA Refugee population by country or territory of origin SM.POP.REFG.OR 1 3 146 121 112 112 79 52 48 34 224 207 192 217 105 90 62 45 50 58 66 66 67
Jamaica JAM Refugee population by country or territory of origin SM.POP.REFG.OR 3 7 10 18 21 27 33 37 37 147 259 350 489 660 766 826 909 1057 1250 1407 1503 1692
Jordan JOR Refugee population by country or territory of origin SM.POP.REFG.OR 55 112 183 242 443 513 708 719 899 973 919 775 1287 1162 1169 1789 1604 1787 1890 2129 2254 2250 2368 1632 1716
Japan JPN Refugee population by country or territory of origin SM.POP.REFG.OR 7 3 2 2 3 3 5 5 19 19 21 13 168 521 185 150 152 176 172 157 263
Kazakhstan KAZ Refugee population by country or territory of origin SM.POP.REFG.OR 1 2 27 139 40163 40774 20459 9057 2537 2803 6315 6559 6121 4316 7376 5235 4825 3744 3632 3500 3571 2136 2212
Kenya KEN Refugee population by country or territory of origin SM.POP.REFG.OR 10 33 63 85 8774 9327 9390 9570 6046 6138 2373 2559 3098 3163 3847 4640 5356 7546 9688 9620 8602 8745 8950 8589 8556
Kyrgyz Republic KGZ Refugee population by country or territory of origin SM.POP.REFG.OR 1 14 22 17118 16320 7449 4003 748 685 2950 3141 3292 3122 2488 2254 2517 2612 2744 3162 3489 2311 2437
Cambodia KHM Refugee population by country or territory of origin SM.POP.REFG.OR 54364 43168 28851 9753 8538 61225 62244 103246 76576 38320 36855 34759 33456 31407 18121 17806 17965 17704 17253 17025 16314 15205 14024 13748 13062
Kiribati KIR Refugee population by country or territory of origin SM.POP.REFG.OR 3 16 32 33 41 38 38 33 33 33 33 20 3
St. Kitts and Nevis KNA Refugee population by country or territory of origin SM.POP.REFG.OR 2 1 1 31 2 2 4 4 7 9 12 15 22
Korea, Rep. KOR Refugee population by country or territory of origin SM.POP.REFG.OR 5 5 7 17 30 42 48 65 75 73 83 245 237 272 268 1335 1188 1104 573 585 514 558 500 481
Kosovo KSV Refugee population by country or territory of origin SM.POP.REFG.OR
Kuwait KWT Refugee population by country or territory of origin SM.POP.REFG.OR 44 47 74 89 756 762 854 825 830 992 692 701 709 616 398 381 617 746 854 938 988 1120 1197 977 994
Latin America & Caribbean (developing only) LAC Refugee population by country or territory of origin SM.POP.REFG.OR 155030 159814 157734 140872 151416 140340 135725 129932 118187 108872 81364 83122 91937 88059 92610 113065 157913 617226 438593 454163 461735 474016 480640 486216 194820
Lao PDR LAO Refugee population by country or territory of origin SM.POP.REFG.OR 135633 122326 96157 74501 54896 58193 46909 37367 29017 21396 16094 12631 11235 10363 16114 24442 26447 10013 8598 8398 8414 8088 7984 7745 7482
Lebanon LBN Refugee population by country or territory of origin SM.POP.REFG.OR 6993 8501 10257 10635 15654 13515 10890 10235 9786 7685 10215 8763 26320 24932 19866 18323 12252 13094 12967 16260 15869 15013 15106 3824 4272
Liberia LBR Refugee population by country or territory of origin SM.POP.REFG.OR 735689 673435 520915 704051 797835 744637 784008 493340 365398 294694 266930 244608 275422 353344 335467 231139 160548 91540 75213 71599 70129 66780 23428 17576 13548
Libya LBY Refugee population by country or territory of origin SM.POP.REFG.OR 581 840 686 597 672 624 281 274 433 568 619 888 1456 1570 1720 1575 1573 1954 2084 2202 2309 4384 5251 3322 4194
St. Lucia LCA Refugee population by country or territory of origin SM.POP.REFG.OR 2 2 3 5 9 11 9 10 16 34 99 163 227 288 314 334 433 566 710 922
Latin America & Caribbean (all income levels) LCN Refugee population by country or territory of origin SM.POP.REFG.OR 170755 174622 172324 156535 168121 155710 149535 140589 126018 111628 83389 85154 95056 91109 96000 117676 163820 624949 446951 462809 470692 484067 491274 496474 204653
Least developed countries: UN classification LDC Refugee population by country or territory of origin SM.POP.REFG.OR 12258482 11676870 10465906 10198870 9888779 8741568 7448024 6621596 6404487 6644430 7739085 7613469 6279953 5641185 5842437 5491269 5435560 6077424 5704660 5994105 6277536 6329840 6458616 6660857 7083034
Low income LIC Refugee population by country or territory of origin SM.POP.REFG.OR 11064566 10821458 9329799 8890202 8669965 7556673 6247725 5565196 5336651 5331889 6375778 6263730 4988756 4399596 4562144 4247082 4159301 5009028 4758917 4934947 5213857 5175270 5362198 5435414 6110670
Liechtenstein LIE Refugee population by country or territory of origin SM.POP.REFG.OR 0
Sri Lanka LKA Refugee population by country or territory of origin SM.POP.REFG.OR 208271 209349 128115 91845 114456 107589 109578 122287 114976 116709 124160 122420 133239 122010 114050 108139 116966 134952 137752 145721 141074 136617 132731 123088 121996
Lower middle income LMC Refugee population by country or territory of origin SM.POP.REFG.OR 1645253 1394273 1978998 2093504 2125671 2075843 2271693 2053271 1920946 2112581 1822969 1987749 2239518 2167234 2273612 2253369 2223111 1963205 1876252 1809160 1838263 2041313 2756986 4554483 6213486
Low & middle income LMY Refugee population by country or territory of origin SM.POP.REFG.OR 14435571 14183786 14081318 13408584 13325614 12008468 11207508 10159009 9682362 9853757 10428604 10474873 9694587 8706226 8667952 8087859 9215871 10826548 9924115 9848240 10032865 9912068 10013890 11293138 13315113
Lesotho LSO Refugee population by country or territory of origin SM.POP.REFG.OR 4 4 55 2 3 3 3 4 1 4 6 7 6 9 7 8 10 11 11 13 15 17
Lithuania LTU Refugee population by country or territory of origin SM.POP.REFG.OR 4 4 8 11 63 109 662 649 282 258 163 216 1371 1541 1482 1448 942 466 490 501 515 528 491 220 183
Luxembourg LUX Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 2 2 1 2
Latvia LVA Refugee population by country or territory of origin SM.POP.REFG.OR 4 4 93 160 1958 1915 1013 907 491 619 3082 3177 2826 2430 1424 662 763 791 713 709 662 233 213
Macao SAR, China MAC Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 1 1 6 8 15 15 20 9 9 9 9 9 10 10 1 1 5
St. Martin (French part) MAF Refugee population by country or territory of origin SM.POP.REFG.OR
Morocco MAR Refugee population by country or territory of origin SM.POP.REFG.OR 15 44 91 105 180 301 297 310 353 377 392 363 1269 1291 1319 2920 4710 4039 3533 2286 2284 2312 2407 1318 1532
Monaco MCO Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 1 1 1 1 1 1 2 4 4 3 3
Moldova MDA Refugee population by country or territory of origin SM.POP.REFG.OR 6 458 529 5829 5141 2754 2407 2657 3737 10130 11146 11937 12064 11680 4918 5555 5925 6200 6264 6148 2207 2242
Madagascar MDG Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 1 3 79 79 76 66 54 54 40 53 88 135 203 260 284 277 274 270 289 301 296 281
Maldives MDV Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 1 1 2 3 4 3 3 1 3 13 17 17 16 16 19 21 24 31 36
Middle East & North Africa (all income levels) MEA Refugee population by country or territory of origin SM.POP.REFG.OR 1228229 1530356 1584149 985856 1019356 950070 945300 916343 878737 864304 761647 1005897 1063565 915116 845300 776961 1943227 2779179 2372429 2017484 1908927 1661705 1696515 3075044 4454220
Mexico MEX Refugee population by country or territory of origin SM.POP.REFG.OR 248 361 520 665 1016 1359 1291 1594 1670 1652 1744 2313 3304 5572 6162 6435 6816 7472 8435 9396 10666
Marshall Islands MHL Refugee population by country or territory of origin SM.POP.REFG.OR 2 3 3
Middle income MIC Refugee population by country or territory of origin SM.POP.REFG.OR 3371005 3362328 4751519 4518382 4655649 4451795 4959783 4593813 4345711 4521868 4052826 4211143 4705831 4306630 4105808 3840777 5056570 5817520 5165198 4913293 4819008 4736798 4651692 5857724 7204443
Macedonia, FYR MKD Refugee population by country or territory of origin SM.POP.REFG.OR 1897 347 12883 13041 12747 1939 2089 2176 12197 8107 5982 5106 8600 7940 8077 7521 7926 7889 7684 7589 1633 1768
Mali MLI Refugee population by country or territory of origin SM.POP.REFG.OR 1 14704 71189 98572 172905 77219 55198 18015 3702 387 364 311 531 461 483 520 594 4494 1758 2926 3663 4295 149943 152864 139267
Malta MLT Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 1 7 13 18 14 17 22 16 7 8 7 3 5 28 9 9 9 6 6 6 6 5
Myanmar MMR Refugee population by country or territory of origin SM.POP.REFG.OR 28 40053 245130 281574 204510 152298 143017 135772 133407 131663 137128 145856 148501 151384 161013 164864 202826 191313 184413 406669 415670 414626 415371 479608 223891
Middle East & North Africa (developing only) MNA Refugee population by country or territory of origin SM.POP.REFG.OR 1228129 1530228 1583981 985582 1017396 947987 942969 914044 876555 862424 760330 1004722 1062067 913536 843862 775698 1940665 2775644 2368897 2013969 1905279 1657643 1692084 3072026 4451133
Montenegro MNE Refugee population by country or territory of origin SM.POP.REFG.OR 135 557 1283 2582 3246 3698 4054 597 604
Mongolia MNG Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 1 1 4 4 7 9 19 25 23 60 280 324 442 654 868 1101 1333 1495 1724 1985 2114 2064 2146
Northern Mariana Islands MNP Refugee population by country or territory of origin SM.POP.REFG.OR
Mozambique MOZ Refugee population by country or territory of origin SM.POP.REFG.OR 1247992 1316636 1445474 1172550 234497 125562 34657 33652 59 35 30 46 130 111 104 104 231 222 208 136 131 155 160 56 58
Mauritania MRT Refugee population by country or territory of origin SM.POP.REFG.OR 65999 79881 79594 67894 68043 84312 83234 70294 70224 29948 29752 29862 30137 30525 31131 31651 33428 33108 45601 39143 37733 39929 33765 34257 34114
Mauritius MUS Refugee population by country or territory of origin SM.POP.REFG.OR 1 13 13 3 15 8 35 35 43 61 19 27 80 71 24 23 28 42 62 81 94
Malawi MWI Refugee population by country or territory of origin SM.POP.REFG.OR 53 50 50 44 60 37 39 34 28 34 33 25 48 59 94 101 113 97 106 130 171 222 277 326 360
Malaysia MYS Refugee population by country or territory of origin SM.POP.REFG.OR 3 4 4 82 79 103 87 90 86 82 79 119 239 292 394 584 615 608 532 552 537 531 485 468
North America NAC Refugee population by country or territory of origin SM.POP.REFG.OR 1 12 14 16 370 249 151 86 67 60 203 224 435 455 507 807 1451 2704 2238 2467 3116 3887 4579 4861 5081
Namibia NAM Refugee population by country or territory of origin SM.POP.REFG.OR 532 204 15 133 65 13 12 2 1902 701 2308 2297 1302 1293 1314 1226 1203 1128 985 921 1017 1073 1098 1142 1253
New Caledonia NCL Refugee population by country or territory of origin SM.POP.REFG.OR
Niger NER Refugee population by country or territory of origin SM.POP.REFG.OR 2 22008 22307 22024 10291 10361 2788 423 514 493 483 834 728 689 655 818 827 796 822 803 819 832 733 738
Nigeria NGA Refugee population by country or territory of origin SM.POP.REFG.OR 16 23 76 100 592 1939 4754 3059 3999 4441 5742 6084 24572 24428 23892 22128 13253 13904 14169 15609 15642 17141 18021 31664 54537
Nicaragua NIC Refugee population by country or territory of origin SM.POP.REFG.OR 52618 46789 44275 33052 28591 23938 22820 22494 21389 20573 5071 4399 4050 3983 1822 1463 1828 1900 1537 1478 1431 1468 1531 1538 1587
Netherlands NLD Refugee population by country or territory of origin SM.POP.REFG.OR 75 85 96 77 57 29 15 4 30 44 48 159 39 43 46 44 53 64 71 64 68
High income: nonOECD NOC Refugee population by country or territory of origin SM.POP.REFG.OR 119072 156610 383231 395812 331282 456028 489315 552718 514825 386348 378821 338860 373920 334483 331387 230999 262968 204142 211312 197278 189652 185675 187289 136544 124979
Norway NOR Refugee population by country or territory of origin SM.POP.REFG.OR 2 1 1 3 4 4 4 3 5 6 5 15 4 3 4 4 7 7 9 13 13
Nepal NPL Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 4 27 44 52 101 186 235 306 902 1231 1416 2065 2647 3364 4189 5108 5889 6854 7612 8112 8561
New Zealand NZL Refugee population by country or territory of origin SM.POP.REFG.OR 2 1 3 4 8 13 10 10 15 18 20 17 17
High income: OECD OEC Refugee population by country or territory of origin SM.POP.REFG.OR 52104 44932 36006 67367 78008 53942 37391 27894 18741 11561 9560 9772 34791 32346 23763 32784 29857 16240 12907 11914 11637 12350 12833 12433 12921
OECD members OED Refugee population by country or territory of origin SM.POP.REFG.OR 57612 51384 46095 84135 107129 99169 88265 75900 64776 56932 58006 58456 230165 219096 200081 205664 260393 243751 233447 164736 165247 159601 156640 88436 87562
Oman OMN Refugee population by country or territory of origin SM.POP.REFG.OR 3 10 10 10 11 11 5 5 19 11 18 12 39 43 56 64 63 60 65 26 29
Other small states OSS Refugee population by country or territory of origin SM.POP.REFG.OR 5617 14879 80692 90866 127437 124656 126780 118760 120896 277132 237676 188975 145037 108496 109782 112002 113307 116107 111422 97257 84368 68233 52889 40128 34379
Pakistan PAK Refugee population by country or territory of origin SM.POP.REFG.OR 486 525 1086 1422 4430 5277 7502 5985 6864 8015 10133 12324 23163 24389 25949 29913 25639 31858 32403 35132 39982 35952 49785 48867 315759
Panama PAN Refugee population by country or territory of origin SM.POP.REFG.OR 629 640 652 677 486 160 149 122 85 72 67 37 44 30 40 42 75 109 111 105 100 100 107 105 89
Peru PER Refugee population by country or territory of origin SM.POP.REFG.OR 256 475 727 1970 4332 5904 6696 6610 7066 7206 6944 6502 6430 5581 4769 4865 6985 7743 7339 6271 5834 5491 5212 4765 4343
Philippines PHL Refugee population by country or territory of origin SM.POP.REFG.OR 10 15 46 113 436 516 598 525 45598 45520 45482 45467 45608 412 434 465 886 1552 1354 993 970 952 986 726 668
Palau PLW Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 1 1
Papua New Guinea PNG Refugee population by country or territory of origin SM.POP.REFG.OR 2000 2008 808 220 9 8 8 16 18 18 23 31 36 46 70 89 128 174 221 288
Poland POL Refugee population by country or territory of origin SM.POP.REFG.OR 25632 21643 14518 13390 35938 19732 12869 7294 1880 1245 865 3191 16712 15211 10677 19641 13513 2915 2391 2059 1764 1815 1640 1429 1310
Puerto Rico PRI Refugee population by country or territory of origin SM.POP.REFG.OR 12 12 12
Korea, Dem. Rep. PRK Refugee population by country or territory of origin SM.POP.REFG.OR 3 7 11 1 9 13 13 19 259 304 343 288 397 605 886 881 917 1052 1132 1166 1282
Portugal PRT Refugee population by country or territory of origin SM.POP.REFG.OR 25 25 217 213 18 15 23 17 62 55 47 74 25 32 36 31 30 28 32 32 31
Paraguay PRY Refugee population by country or territory of origin SM.POP.REFG.OR 19 8 9 14 63 51 44 20 21 18 19 8 31 32 37 44 105 102 101 77 86 91 101 95 94
Pacific island small states PSS Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 19 89 157 259 345 367 341 368 442 778 1140 1178 1382 1443 1776 1924 1972 1996 1967 1697 1429 1219 1027
French Polynesia PYF Refugee population by country or territory of origin SM.POP.REFG.OR 1 1
Qatar QAT Refugee population by country or territory of origin SM.POP.REFG.OR 49 30 18 19 23 8 1 8 13 10 11 52 62 71 68 112 95 124 17 21
Romania ROU Refugee population by country or territory of origin SM.POP.REFG.OR 51282 27177 25118 23572 22278 16978 11871 8951 10921 8558 7348 6052 8847 8387 5916 11502 7234 5306 4756 4358 3934 3428 2807 2329 1921
Russian Federation RUS Refugee population by country or territory of origin SM.POP.REFG.OR 117736 155576 213802 243312 251393 207034 173723 198063 172730 28314 40310 45156 91626 96420 107975 103037 159381 93224 103061 109455 111948 109785 110588 74357 72777
Rwanda RWA Refugee population by country or territory of origin SM.POP.REFG.OR 361322 431240 434736 450462 2257573 1819366 469136 68003 77743 88944 119056 84513 75257 75263 63812 100264 92966 80964 72530 129109 115524 106833 97373 83937 79411
South Asia SAS Refugee population by country or territory of origin SM.POP.REFG.OR 6548528 6526699 4811737 3611828 3012792 2958743 2963692 2966999 2909068 2848536 3847613 4072784 2800281 2406923 2680150 2436405 2386475 3369159 3142120 3192116 3344561 2928157 2842313 2789102 3084660
Saudi Arabia SAU Refugee population by country or territory of origin SM.POP.REFG.OR 7 183 260 242 358 362 233 77 35 109 236 214 151 617 753 712 633 667 745 818 584 630
Sudan SDN Refugee population by country or territory of origin SM.POP.REFG.OR 523998 196242 267767 393871 405135 445280 475305 364589 390013 485460 494363 489950 508877 606242 730650 693632 686311 523032 419248 368195 387288 500014 568943 649331 659395
Senegal SEN Refugee population by country or territory of origin SM.POP.REFG.OR 60006 25138 15466 22601 25622 17592 17631 17163 9716 11606 11088 8559 12069 8351 8332 8671 15163 15896 16006 16305 16267 17722 18724 19884 23118
Singapore SGP Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 9 9 19 22 23 25 22 16 39 35 36 39 111 116 109 80 76 67 68 65 59
Solomon Islands SLB Refugee population by country or territory of origin SM.POP.REFG.OR 34 34 34 34 34 34 42 54 60 61 27 38 48 52 66 75 72 61 61 70
Sierra Leone SLE Refugee population by country or territory of origin SM.POP.REFG.OR 9 142614 253592 311183 275302 379495 375104 329327 406077 490061 402807 179113 141475 70580 41802 40477 42863 32127 32536 15417 11275 8002 6202 5320 4997
El Salvador SLV Refugee population by country or territory of origin SM.POP.REFG.OR 30019 33049 30855 26124 30735 23535 19639 17126 12591 12410 7756 7150 6632 5658 4497 4281 6388 6022 5151 5051 4976 6720 8171 9638 10965
San Marino SMR Refugee population by country or territory of origin SM.POP.REFG.OR 2 4 4 4 3 1 1 1 2 2 1 1 2 1 1 1 1
Somalia SOM Refugee population by country or territory of origin SM.POP.REFG.OR 470174 732594 812195 574617 631426 638698 636985 608094 557959 524613 475655 440134 432316 402336 389314 395553 464038 457356 561155 678309 770154 1077048 1136719 1121738 1106068
Serbia SRB Refugee population by country or territory of origin SM.POP.REFG.OR 1745 45823 90081 58253 54976 86120 103967 106654 115292 172509 146748 144231 327587 296632 236999 189989 174027 165643 185935 195626 183289 161671 158908 48693 45854
Sub-Saharan Africa (developing only) SSA Refugee population by country or territory of origin SM.POP.REFG.OR 5746923 5169222 5425934 6325967 6727531 5624086 4354238 3541069 3413703 3617883 3768730 3464234 3524779 3311884 3221404 3095896 3039422 2747691 2627681 2665750 2810105 3371620 3535158 3703899 4368550
South Sudan SSD Refugee population by country or territory of origin SM.POP.REFG.OR 1 87009 114467 616142
Sub-Saharan Africa (all income levels) SSF Refugee population by country or territory of origin SM.POP.REFG.OR 5746983 5169351 5426102 6326209 6728426 5624768 4354773 3541575 3414162 3618341 3769262 3464776 3525375 3312513 3222000 3096413 3039944 2748153 2628118 2666143 2810459 3371920 3535415 3704125 4368749
Small states SST Refugee population by country or territory of origin SM.POP.REFG.OR 12245 20807 83260 91856 128622 125844 128000 119903 121880 278120 238656 190224 146699 110362 112170 115053 117380 121072 116714 102816 90207 74506 59473 47002 41627
Sao Tome and Principe STP Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 1 1 30 36 49 43 42 30 25 23 39 42 39 24 32 33 35 33 33 33 32 31 22
Suriname SUR Refugee population by country or territory of origin SM.POP.REFG.OR 6620 5921 2545 893 915 817 754 663 491 411 334 237 103 70 51 29 66 63 50 45 25 20 15 17 17
Slovak Republic SVK Refugee population by country or territory of origin SM.POP.REFG.OR 12 26 57 70 143 178 220 191 595 667 619 791 741 342 331 334 158 269 239 323 319
Slovenia SVN Refugee population by country or territory of origin SM.POP.REFG.OR 28429 14829 12860 3368 3414 3302 3295 3284 765 858 610 582 155 1760 52 52 39 38 32 34 28 26
Sweden SWE Refugee population by country or territory of origin SM.POP.REFG.OR 11 25 38 40 41 31 18 5 28 32 29 75 16 16 15 19 25 24 20 17 18
Swaziland SWZ Refugee population by country or territory of origin SM.POP.REFG.OR 1 13 15 17 20 30 28 16 15 19 5 14 13 22 25 32 32 36 43 65 109 161
Sint Maarten (Dutch part) SXM Refugee population by country or territory of origin SM.POP.REFG.OR 0
Seychelles SYC Refugee population by country or territory of origin SM.POP.REFG.OR 60 69 54 28 553 339 138 33 39 29 23 13 44 38 44 40 61 55 53 49 49 42 29 26 25
Syrian Arab Republic SYR Refugee population by country or territory of origin SM.POP.REFG.OR 2148 3037 4408 5404 7087 7994 8609 8653 8126 6695 5871 4869 18913 20819 21439 16401 12337 13690 15211 17914 18452 19931 729022 2468369 3865720
Turks and Caicos Islands TCA Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 1 1 1 14 14 15 15
Chad TCD Refugee population by country or territory of origin SM.POP.REFG.OR 184806 72319 66381 212932 211971 59727 58445 55025 61298 58797 54962 46294 47349 52275 52663 48400 36300 55722 55105 55014 53733 42640 39694 48644 14855
Togo TGO Refugee population by country or territory of origin SM.POP.REFG.OR 6 18 106 291060 167871 93155 25593 7187 3506 3692 4016 4354 10448 10614 10819 51107 27332 22502 16750 18378 18330 17871 15693 10347 9277
Thailand THA Refugee population by country or territory of origin SM.POP.REFG.OR 20 30 35 36 137 211 284 272 295 318 217 94 344 296 319 424 3325 2325 1815 502 356 368 381 222 231
Tajikistan TJK Refugee population by country or territory of origin SM.POP.REFG.OR 60008 70108 57144 58956 107503 75878 56349 45167 59940 56108 63267 58936 56780 54753 645 894 544 562 577 612 674 661 713
Turkmenistan TKM Refugee population by country or territory of origin SM.POP.REFG.OR 7 47 2937 3181 1562 1051 300 310 801 840 812 820 692 678 736 743 738 726 723 517 486
Timor-Leste TLS Refugee population by country or territory of origin SM.POP.REFG.OR 162472 122202 73042 28097 127 221 251 251 6 7 7 8 8 9 10 13
Tonga TON Refugee population by country or territory of origin SM.POP.REFG.OR 3 3 2 2 3 1 8 12 5 4 6 5 7 5 6 10 13 18 22
Trinidad and Tobago TTO Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 1 1 13 14 16 21 26 25 24 16 35 38 41 63 153 211 231 240 255 297 333 336 371
Tunisia TUN Refugee population by country or territory of origin SM.POP.REFG.OR 42 63 86 104 212 333 406 698 932 1240 1207 1368 2543 2563 2518 3129 2845 2507 2349 2260 2174 1952 1935 1371 1486
Turkey TUR Refugee population by country or territory of origin SM.POP.REFG.OR 5508 6452 10089 16768 28873 44866 50354 47341 45019 44012 47155 47090 193704 185098 174574 170567 227232 221939 214378 146387 146794 139779 135372 66607 63975
Tuvalu TUV Refugee population by country or territory of origin SM.POP.REFG.OR 3 3 3 3 3 3 3 3 3 3 3 2 2 1 1 2 2
Taiwan, China TWN Refugee population by country or territory of origin SM.POP.REFG.OR
Tanzania TZA Refugee population by country or territory of origin SM.POP.REFG.OR 8 11 20 32 62 68 65 66 102 118 313 378 580 711 985 1549 1667 1255 1270 1204 1144 1163 1122 1040 857
Uganda UGA Refugee population by country or territory of origin SM.POP.REFG.OR 58820 39386 32456 33415 31450 24166 28339 55241 13301 13937 32414 40141 40425 35247 31963 34225 21752 21341 7548 7554 6441 5680 5608 8177 7190
Ukraine UKR Refugee population by country or territory of origin SM.POP.REFG.OR 38 134 915 1701 6107 6348 4596 12236 19312 26716 85265 94148 89579 84228 63723 25985 28424 24522 25111 25379 25256 5172 237636
Upper middle income UMC Refugee population by country or territory of origin SM.POP.REFG.OR 1725752 1968055 2772521 2424878 2529978 2375952 2688090 2540542 2424765 2409287 2229857 2223394 2466313 2139396 1832196 1587408 2833459 3854315 3288946 3104133 2980745 2695485 1894706 1303241 990957
Uruguay URY Refugee population by country or territory of origin SM.POP.REFG.OR 842 601 429 162 362 262 201 89 74 39 51 46 61 57 81 111 163 197 199 188 186 184 171 146 124
United States USA Refugee population by country or territory of origin SM.POP.REFG.OR 1 8 10 12 366 245 143 75 51 41 176 219 383 395 451 683 1356 2174 2137 2368 3026 3778 4456 4761 4986
Uzbekistan UZB Refugee population by country or territory of origin SM.POP.REFG.OR 2 29060 143 69747 69069 51729 45533 3628 3458 6881 7391 7288 8323 9102 5663 6308 6669 8840 12664 11593 4965 4796
St. Vincent and the Grenadines VCT Refugee population by country or territory of origin SM.POP.REFG.OR 7 7 13 13 24 36 48 67 81 105 181 279 387 646 750 849 946 1127 1316 1535 1736
Venezuela, RB VEN Refugee population by country or territory of origin SM.POP.REFG.OR 1 4 135 371 476 557 608 570 556 471 466 526 598 1256 2590 3829 5094 5807 6221 6701 7577 8208 8395 8009
Virgin Islands (U.S.) VIR Refugee population by country or territory of origin SM.POP.REFG.OR
Vietnam VNM Refugee population by country or territory of origin SM.POP.REFG.OR 496029 498323 517111 527627 539101 543541 518340 476795 435437 405377 370758 353224 373741 363179 349780 358268 374279 327776 328183 339289 338698 337829 336939 314105 313418
Vanuatu VUT Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 1 1 1
West Bank and Gaza PSE Refugee population by country or territory of origin SM.POP.REFG.OR 8521 65177 95343 81474 82564 72768 80215 76821 77524 100602 110640 349161 428782 350568 350617 349673 334142 341237 340016 95201 93323 94150 94918 96044 97235
World WLD Refugee population by country or territory of origin SM.POP.REFG.OR 19805688 19414923 20023531 18718993 18325596 17418028 16102005 14934398 14552205 14863846 15451236 15643310 14265347 13437842 13530667 12863676 14326136 15953753 15161623 15163210 15516348 15202525 15417872 15727390 17531780
Samoa WSM Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 1 1 1 1 3 2 4 1 1 1 1 1
Yemen, Rep. YEM Refugee population by country or territory of origin SM.POP.REFG.OR 8 73 31 39 150 369 1154 1721 1935 2022 2113 1985 1600 1597 1606 1325 1362 1632 1777 1934 2076 2323 2594 2428 2628
South Africa ZAF Refugee population by country or territory of origin SM.POP.REFG.OR 14783 11206 9241 9094 1514 488 290 244 188 193 168 123 275 288 272 268 510 474 453 384 380 429 420 423 424
Congo, Dem. Rep. COD Refugee population by country or territory of origin SM.POP.REFG.OR 67423 65816 81269 74826 73286 89738 158794 173995 158833 255950 371713 392146 421362 453465 462208 430929 401914 370374 367995 455852 476693 491481 509290 499541 516562
Zambia ZMB Refugee population by country or territory of origin SM.POP.REFG.OR 1 1 1990 1574 16 20 40 63 77 87 98 62 92 100 124 151 203 196 195 206 228 240 243 232 316
Zimbabwe ZWE Refugee population by country or territory of origin SM.POP.REFG.OR 4 128 9 17 42 36 34 38 42 43 109 257 4030 7162 9568 11251 12782 14374 16841 22449 24089 25048 22101 19681 22494
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Module 2 assignment</title>
<!--<script type="text/javascript" src="../d3.js"></script>-->
<script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>
<div class="content-wrapper">
<div class="intro">
<h1>Refugee population by country of origin</h1>
<div class="intro"></div>
</div>
<!-- SVG hook -->
<div id="main-chart-hook"></div>
<div id="small-multiples-hook"></div>
<div class='meta source'>Source:
<a href="http://data.worldbank.org/indicator/SM.POP.REFG.OR/" target="_blank">Worldbank, 2015</a>
</div>
</div>
<div id="tooltip" class="none"></div>
<script type="text/javascript" src="stacked_chart.js"></script>
</body>
</html>
html, body {
margin: 0;
padding: 0;
}
* { outline: none; }
body {
font-family: Helvetiva, Arial;
background: #EFEFEF;
}
h1, h2, h3 {
font-family: "Helvetica Neue";
}
h1 {
margin: 0 0 .5em;
padding: 0;
font-weight: 400;
}
.none { display: none; }
.content-wrapper {
max-width: 960px;
min-width: 360px;
margin: 0 auto;
border-left: 1px solid #D7D9E2;
border-right: 1px solid #D7D9E2;
padding: 20px;
background: #FFF;
min-height: 100vh;
height: 100%;
}
.intro {
margin-bottom: 20px;
}
.source {
font-size: .8em;
}
#main-chart-hook {
padding-bottom: 20px;
}
/* TOOLTIP */
#tooltip {
position: absolute;
padding: 8px 20px;
background: #FFF;
border-radius: 4px;
box-shadow: 1px 1px 1px #CCC;
border: 1px solid #CCC;
pointer-events: none;
}
.tooltip-label {
font-size: 1.1em;
padding-bottom: .4em;
}
.tooltip-years-list {
margin: 0;
padding: 0;
}
.tooltip-years-list li {
list-style: none;
border-bottom: 1px solid #CCC;
padding: 4px;
}
.tooltip-years-list li.active {
background: #FFF7D7;
}
.tooltip-years-list .year-label {
display: inline-block;
padding-right: 25px;
font-size: .8em;
color: #675C5C;
}
.tooltip-years-list .year-value {
font-size: .9em;
}
/* SVG */
path {
opacity: .5;
}
path.hover {
opacity: 1;
}
.axis path,
.axis line {
fill: none;
stroke: #D0CBC4;
shape-rendering: crispEdges;
pointer-events: none;
}
.axis text {
font-family: sans-serif;
font-size: 11px;
}
rect {
fill: #FFD974;
transition: fill 0.3s;
}
rect:hover {
fill: #FFC11D;
}
.y.axis path,
.y.axis line {
opacity: 0;
}
text.multiples-title {
text-transform: capitalize;
font-weight: bold;
font-size: .9em;
}
svg.continent {
padding-right: 20px;
}
function getClientWidth() {
return document.getElementsByClassName("content-wrapper")[0].clientWidth;
}
var country_code;
var filepath = 'data_refugee_by_origin.csv' //'data_refugee_by_origin.csv';
var startYear = 1990;
var endYear = 2014;
var years = createYearsArr(startYear, endYear);
var w = 940;
var h = 400;
var sw = 300;
var sh = 200;
var padding = { top:40,
right: 0,
bottom: 30,
left: 40 };
//Set up date formatting and years
var dateFormat = d3.time.format("%Y");
var stack = d3.layout.stack()
.values(function(d) {
return d.values;
})
.order("reverse");
//Set up date format function (years)
var dateFormat = d3.time.format("%Y");
//Set up scales
var xScale = d3.time.scale()
.range([ padding.left, sw - padding.right ]);
var yScale = d3.scale.linear()
.range([ padding.top, sh - padding.bottom ]);
//Configure axis generators
var xAxis = d3.svg.axis()
.scale(xScale)
.orient("bottom")
.tickFormat(function(d) {
return dateFormat(d);
});
var yAxis = d3.svg.axis()
.scale(yScale)
.orient("left")
.tickFormat(d3.format("s"));
var area = d3.svg.area()
.x(function(d) {
return xScale(dateFormat.parse(d.x));
})
.y0(function(d) {
return yScale(d.y0); //Updated
})
.y1(function(d) {
return yScale(d.y0 + d.y); //Updated
});
var colorbrewer = {YlGn:{3:["#f7fcb9","#addd8e","#31a354"],4:["#ffffcc","#c2e699","#78c679","#238443"],5:["#ffffcc","#c2e699","#78c679","#31a354","#006837"],6:["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],7:["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],8:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],9:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"]},YlGnBu:{3:["#edf8b1","#7fcdbb","#2c7fb8"],4:["#ffffcc","#a1dab4","#41b6c4","#225ea8"],5:["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"],6:["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#2c7fb8","#253494"],7:["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],8:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],9:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]},GnBu:{3:["#e0f3db","#a8ddb5","#43a2ca"],4:["#f0f9e8","#bae4bc","#7bccc4","#2b8cbe"],5:["#f0f9e8","#bae4bc","#7bccc4","#43a2ca","#0868ac"],6:["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#43a2ca","#0868ac"],7:["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],8:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],9:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"]},BuGn:{3:["#e5f5f9","#99d8c9","#2ca25f"],4:["#edf8fb","#b2e2e2","#66c2a4","#238b45"],5:["#edf8fb","#b2e2e2","#66c2a4","#2ca25f","#006d2c"],6:["#edf8fb","#ccece6","#99d8c9","#66c2a4","#2ca25f","#006d2c"],7:["#edf8fb","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],8:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],9:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"]},PuBuGn:{3:["#ece2f0","#a6bddb","#1c9099"],4:["#f6eff7","#bdc9e1","#67a9cf","#02818a"],5:["#f6eff7","#bdc9e1","#67a9cf","#1c9099","#016c59"],6:["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#1c9099","#016c59"],7:["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],8:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],9:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"]},PuBu:{3:["#ece7f2","#a6bddb","#2b8cbe"],4:["#f1eef6","#bdc9e1","#74a9cf","#0570b0"],5:["#f1eef6","#bdc9e1","#74a9cf","#2b8cbe","#045a8d"],6:["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#2b8cbe","#045a8d"],7:["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],8:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],9:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"]},BuPu:{3:["#e0ecf4","#9ebcda","#8856a7"],4:["#edf8fb","#b3cde3","#8c96c6","#88419d"],5:["#edf8fb","#b3cde3","#8c96c6","#8856a7","#810f7c"],6:["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8856a7","#810f7c"],7:["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],8:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],9:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"]},RdPu:{3:["#fde0dd","#fa9fb5","#c51b8a"],4:["#feebe2","#fbb4b9","#f768a1","#ae017e"],5:["#feebe2","#fbb4b9","#f768a1","#c51b8a","#7a0177"],6:["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#c51b8a","#7a0177"],7:["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],8:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],9:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"]},PuRd:{3:["#e7e1ef","#c994c7","#dd1c77"],4:["#f1eef6","#d7b5d8","#df65b0","#ce1256"],5:["#f1eef6","#d7b5d8","#df65b0","#dd1c77","#980043"],6:["#f1eef6","#d4b9da","#c994c7","#df65b0","#dd1c77","#980043"],7:["#f1eef6","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],8:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],9:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"]},OrRd:{3:["#fee8c8","#fdbb84","#e34a33"],4:["#fef0d9","#fdcc8a","#fc8d59","#d7301f"],5:["#fef0d9","#fdcc8a","#fc8d59","#e34a33","#b30000"],6:["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#e34a33","#b30000"],7:["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],8:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],9:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"]},YlOrRd:{3:["#ffeda0","#feb24c","#f03b20"],4:["#ffffb2","#fecc5c","#fd8d3c","#e31a1c"],5:["#ffffb2","#fecc5c","#fd8d3c","#f03b20","#bd0026"],6:["#ffffb2","#fed976","#feb24c","#fd8d3c","#f03b20","#bd0026"],7:["#ffffb2","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],8:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],9:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"]},YlOrBr:{3:["#fff7bc","#fec44f","#d95f0e"],4:["#ffffd4","#fed98e","#fe9929","#cc4c02"],5:["#ffffd4","#fed98e","#fe9929","#d95f0e","#993404"],6:["#ffffd4","#fee391","#fec44f","#fe9929","#d95f0e","#993404"],7:["#ffffd4","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],8:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],9:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"]},Purples:{3:["#efedf5","#bcbddc","#756bb1"],4:["#f2f0f7","#cbc9e2","#9e9ac8","#6a51a3"],5:["#f2f0f7","#cbc9e2","#9e9ac8","#756bb1","#54278f"],6:["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#756bb1","#54278f"],7:["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],8:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],9:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]},Blues:{3:["#deebf7","#9ecae1","#3182bd"],4:["#eff3ff","#bdd7e7","#6baed6","#2171b5"],5:["#eff3ff","#bdd7e7","#6baed6","#3182bd","#08519c"],6:["#eff3ff","#c6dbef","#9ecae1","#6baed6","#3182bd","#08519c"],7:["#eff3ff","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],8:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],9:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]},Greens:{3:["#e5f5e0","#a1d99b","#31a354"],4:["#edf8e9","#bae4b3","#74c476","#238b45"],5:["#edf8e9","#bae4b3","#74c476","#31a354","#006d2c"],6:["#edf8e9","#c7e9c0","#a1d99b","#74c476","#31a354","#006d2c"],7:["#edf8e9","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],8:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],9:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]},Oranges:{3:["#fee6ce","#fdae6b","#e6550d"],4:["#feedde","#fdbe85","#fd8d3c","#d94701"],5:["#feedde","#fdbe85","#fd8d3c","#e6550d","#a63603"],6:["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#e6550d","#a63603"],7:["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],8:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],9:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]},Reds:{3:["#fee0d2","#fc9272","#de2d26"],4:["#fee5d9","#fcae91","#fb6a4a","#cb181d"],5:["#fee5d9","#fcae91","#fb6a4a","#de2d26","#a50f15"],6:["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#de2d26","#a50f15"],7:["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],8:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],9:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]},Greys:{3:["#f0f0f0","#bdbdbd","#636363"],4:["#f7f7f7","#cccccc","#969696","#525252"],5:["#f7f7f7","#cccccc","#969696","#636363","#252525"],6:["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#636363","#252525"],7:["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],8:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],9:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]},PuOr:{3:["#f1a340","#f7f7f7","#998ec3"],4:["#e66101","#fdb863","#b2abd2","#5e3c99"],5:["#e66101","#fdb863","#f7f7f7","#b2abd2","#5e3c99"],6:["#b35806","#f1a340","#fee0b6","#d8daeb","#998ec3","#542788"],7:["#b35806","#f1a340","#fee0b6","#f7f7f7","#d8daeb","#998ec3","#542788"],8:["#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788"],9:["#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788"],10:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],11:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"]},BrBG:{3:["#d8b365","#f5f5f5","#5ab4ac"],4:["#a6611a","#dfc27d","#80cdc1","#018571"],5:["#a6611a","#dfc27d","#f5f5f5","#80cdc1","#018571"],6:["#8c510a","#d8b365","#f6e8c3","#c7eae5","#5ab4ac","#01665e"],7:["#8c510a","#d8b365","#f6e8c3","#f5f5f5","#c7eae5","#5ab4ac","#01665e"],8:["#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e"],9:["#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e"],10:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],11:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]},PRGn:{3:["#af8dc3","#f7f7f7","#7fbf7b"],4:["#7b3294","#c2a5cf","#a6dba0","#008837"],5:["#7b3294","#c2a5cf","#f7f7f7","#a6dba0","#008837"],6:["#762a83","#af8dc3","#e7d4e8","#d9f0d3","#7fbf7b","#1b7837"],7:["#762a83","#af8dc3","#e7d4e8","#f7f7f7","#d9f0d3","#7fbf7b","#1b7837"],8:["#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837"],9:["#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837"],10:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],11:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]},PiYG:{3:["#e9a3c9","#f7f7f7","#a1d76a"],4:["#d01c8b","#f1b6da","#b8e186","#4dac26"],5:["#d01c8b","#f1b6da","#f7f7f7","#b8e186","#4dac26"],6:["#c51b7d","#e9a3c9","#fde0ef","#e6f5d0","#a1d76a","#4d9221"],7:["#c51b7d","#e9a3c9","#fde0ef","#f7f7f7","#e6f5d0","#a1d76a","#4d9221"],8:["#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221"],9:["#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221"],10:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],11:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]},RdBu:{3:["#ef8a62","#f7f7f7","#67a9cf"],4:["#ca0020","#f4a582","#92c5de","#0571b0"],5:["#ca0020","#f4a582","#f7f7f7","#92c5de","#0571b0"],6:["#b2182b","#ef8a62","#fddbc7","#d1e5f0","#67a9cf","#2166ac"],7:["#b2182b","#ef8a62","#fddbc7","#f7f7f7","#d1e5f0","#67a9cf","#2166ac"],8:["#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac"],9:["#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac"],10:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],11:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]},RdGy:{3:["#ef8a62","#ffffff","#999999"],4:["#ca0020","#f4a582","#bababa","#404040"],5:["#ca0020","#f4a582","#ffffff","#bababa","#404040"],6:["#b2182b","#ef8a62","#fddbc7","#e0e0e0","#999999","#4d4d4d"],7:["#b2182b","#ef8a62","#fddbc7","#ffffff","#e0e0e0","#999999","#4d4d4d"],8:["#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d"],9:["#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d"],10:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],11:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"]},RdYlBu:{3:["#fc8d59","#ffffbf","#91bfdb"],4:["#d7191c","#fdae61","#abd9e9","#2c7bb6"],5:["#d7191c","#fdae61","#ffffbf","#abd9e9","#2c7bb6"],6:["#d73027","#fc8d59","#fee090","#e0f3f8","#91bfdb","#4575b4"],7:["#d73027","#fc8d59","#fee090","#ffffbf","#e0f3f8","#91bfdb","#4575b4"],8:["#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4"],9:["#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4"],10:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],11:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]},Spectral:{3:["#fc8d59","#ffffbf","#99d594"],4:["#d7191c","#fdae61","#abdda4","#2b83ba"],5:["#d7191c","#fdae61","#ffffbf","#abdda4","#2b83ba"],6:["#d53e4f","#fc8d59","#fee08b","#e6f598","#99d594","#3288bd"],7:["#d53e4f","#fc8d59","#fee08b","#ffffbf","#e6f598","#99d594","#3288bd"],8:["#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd"],9:["#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd"],10:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],11:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]},RdYlGn:{3:["#fc8d59","#ffffbf","#91cf60"],4:["#d7191c","#fdae61","#a6d96a","#1a9641"],5:["#d7191c","#fdae61","#ffffbf","#a6d96a","#1a9641"],6:["#d73027","#fc8d59","#fee08b","#d9ef8b","#91cf60","#1a9850"],7:["#d73027","#fc8d59","#fee08b","#ffffbf","#d9ef8b","#91cf60","#1a9850"],8:["#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850"],9:["#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850"],10:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],11:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]},Accent:{3:["#7fc97f","#beaed4","#fdc086"],4:["#7fc97f","#beaed4","#fdc086","#ffff99"],5:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0"],6:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f"],7:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17"],8:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"]},Dark2:{3:["#1b9e77","#d95f02","#7570b3"],4:["#1b9e77","#d95f02","#7570b3","#e7298a"],5:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e"],6:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02"],7:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"],8:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"]},Paired:{3:["#a6cee3","#1f78b4","#b2df8a"],4:["#a6cee3","#1f78b4","#b2df8a","#33a02c"],5:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99"],6:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c"],7:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f"],8:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00"],9:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6"],10:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a"],11:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99"],12:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"]},Pastel1:{3:["#fbb4ae","#b3cde3","#ccebc5"],4:["#fbb4ae","#b3cde3","#ccebc5","#decbe4"],5:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6"],6:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc"],7:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd"],8:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec"],9:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},Pastel2:{3:["#b3e2cd","#fdcdac","#cbd5e8"],4:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4"],5:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9"],6:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae"],7:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc"],8:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"]},Set1:{3:["#e41a1c","#377eb8","#4daf4a"],4:["#e41a1c","#377eb8","#4daf4a","#984ea3"],5:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00"],6:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33"],7:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628"],8:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf"],9:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"]},Set2:{3:["#66c2a5","#fc8d62","#8da0cb"],4:["#66c2a5","#fc8d62","#8da0cb","#e78ac3"],5:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854"],6:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f"],7:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494"],8:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"]},Set3:{3:["#8dd3c7","#ffffb3","#bebada"],4:["#8dd3c7","#ffffb3","#bebada","#fb8072"],5:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3"],6:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462"],7:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69"],8:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5"],9:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9"],10:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd"],11:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5"],12:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]}};
var color = d3.scale.ordinal()
.range(colorbrewer.Spectral[8]);
var aggregateCountries = ['ARB', 'CEB', 'CSS','ECA', 'EAP', 'EAS', 'ECS', 'EMU', 'EUU', 'FCS', 'HIC', 'HPC', 'LAC', 'LCN', 'LDC', 'LIC', 'LMC', 'LMY', 'MEA', 'MIC', 'MNA', 'NAC', 'NOC', 'OEC', 'OED', 'OSS', 'PSS', 'SAS', 'SSA', 'SSF', 'SST', 'UMC', 'WLD'];
function initMetaData() {
d3.csv('country_code.csv', function(data) {
country_code = data;
initData(filepath);
});
}
function initData(dataPath) {
d3.csv(dataPath, function(data) {
data = data.filter(function(d) {
for(var i = 0; i < aggregateCountries.length; i++) {
if(d.Code === aggregateCountries[i]) { return false; }
}
return true;
});
var dataset = transformData(data);
createAreaChart('WORLD', dataset, '#main-chart-hook', {w: w, h: h});
createSmallMultiples(dataset);
});
}
function createSmallMultiples(dataset) {
var uniqueContinents = getUniqueContinents(country_code);
// create small multiples
for (var i = 0; i < uniqueContinents.length; i++) {
// lets skip the arctic
if(uniqueContinents[i] === 'ARCTIC'){ return false; }
var filteredData = filterData(dataset, uniqueContinents[i]);
createAreaChart(uniqueContinents[i], filteredData, '#small-multiples-hook', {w: sw, h: sh});
}
}
function createAreaChart(selectedContinent, dataset, svgHook, size) {
var totalTicksX = Math.round(size.w / 40),
totalTicksY = Math.round(size.h / 40);
xAxis.ticks(totalTicksX);
yAxis.ticks(totalTicksY);
xScale.range([ padding.left, size.w - padding.right ]);
yScale.range([ padding.top, size.h - padding.bottom ]);
var continent = d3.select(svgHook)
.append("svg")
.attr("class", "continent " + selectedContinent)
.attr("width", size.w)
.attr("height", size.h);
continent.append("text")
.attr("x", (10))
.attr("y", padding.top/2)
.attr("class", "multiples-title")
.text(selectedContinent.toLowerCase());
stack(dataset);
xScale.domain([
d3.min(years, function(d) {
return dateFormat.parse(d);
}),
d3.max(years, function(d) {
return dateFormat.parse(d);
})
]);
var totals = [];
for (i = 0; i < years.length; i++) {
totals[i] = 0;
for (j = 0; j < dataset.length; j++) {
totals[i] += dataset[j].values[i].y;
}
}
yScale.domain([ d3.max(totals), 0 ]);
var paths = continent.selectAll("path")
.data(dataset)
.enter()
.append("path")
.attr("class", "area")
.attr("d", function(d) {
return area(d.values);
})
.attr("stroke", "none")
.attr("fill", function(d, i) {
setColor(d.continent);
return color(i);
})
.on("mouseover", function(d) {
//Get this bar's x/y values, then augment for the tooltip
var xPosition = (d3.event.pageX);
var yPosition = (d3.event.pageY - 28);
var content = getTooltipContent(d);
d3.select(this)
.classed('hover', true);
//Update the tooltip position and value
d3.select("#tooltip")
.style("left", xPosition + "px")
.style("top", yPosition + "px")
.html(content);
//Show the tooltip
d3.select("#tooltip").classed("none", false);
})
.on("mouseout", function() {
d3.select("#tooltip").classed("none", true);
d3.select(this)
.classed('hover', false);
});
continent.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + (size.h - padding.bottom) + ")")
.call(xAxis);
continent.append("g")
.attr("class", "y axis")
.attr("transform", "translate(" + padding.left + ",0)")
.call(yAxis);
}
initMetaData();
/* helper functions - need to clean up here */
function setColor(continent){
var brewer = '';
switch(continent) {
case 'ASIA':
brewer = colorbrewer.BrBG[8];
break;
case 'SOUTH AMERICA':
brewer = colorbrewer.BuPu[8];
break;
case 'NORTH AMERICA':
brewer = colorbrewer.YlOrRd[8];
break;
case 'AFRICA':
brewer = colorbrewer.Blues[8];
break;
case 'EUROPE':
brewer = colorbrewer.Greens[8];
break;
case 'PACIFIC':
brewer = colorbrewer.PiYG[8];
break;
case 'SOUTH AMERICA':
brewer = colorbrewer.PuOr[8];
break;
default:
brewer = colorbrewer.Spectral[8];
}
color.range(brewer);
}
function createYearsArr(start, end) {
var arr = [];
for (var i = start; i <= end; i++ ) {
arr.push(String(i));
}
return arr;
}
function transformData(data) {
var dataset = [];
for (var i = 0; i < data.length; i++) {
var continentArr = country_code.filter(function(d, index){
if (!d.iso3_code || !data[i]) {
return false;
}
return d.iso3_code === data[i].Code
});
var continent = continentArr[0] ? continentArr[0].continent : undefined;
dataset[i] = {
country: data[i].Country,
values: [],
total: 0,
continent: continent
};
for (var j = 0; j < years.length; j++) {
//Default value, used in case no value is present
var amount = 0;
// If value is not empty
if (data[i][years[j]]) {
amount = +data[i][years[j]];
dataset[i].total += amount;
}
dataset[i].values.push({
x: years[j],
y: amount
});
}
}
return dataset;
}
function onlyUnique(value, index, self) {
return self.indexOf(value) === index;
}
function getTooltipContent(data) {
var html = '<div class="tooltip-label">' + data.country + '</h1>';
return html;
}
function filterData(data, continent) {
data = data.filter(function(d, i) {
if( d.continent === continent) {
return true;
}
});
return data;
};
function getUniqueContinents(data){
var continents = country_code.map(function(obj) { return obj.continent; });
var uniqueContinents = continents.filter(onlyUnique);
return uniqueContinents;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment