Skip to content

Instantly share code, notes, and snippets.

@philgyford
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philgyford/af4933f298301df47854 to your computer and use it in GitHub Desktop.
Save philgyford/af4933f298301df47854 to your computer and use it in GitHub Desktop.
Multi-multi-line d3 problem
Country 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
Australia 2413484152.76067 2437003023.85486 2772986896.62896 2796505767.72315 3549109642.73715 3428155448.53847 3525590771.64296 3915332064.06093 4016127225.89316 4377869862.24661 5354462985.77668 5715085675.88756 6663551401.86916 9019859064.70211 11680176860.7222 13874095316.1273 14185049792.0081 15449644413.8564 16123392736.296 19275247074.8608 24616155988.8579 26334610472.5415 26231932031.3362 24060832943.3786 26236189096.1782 27497123571.3738 27321628427.5322 29290629962.9434 37674621653.085 45334256168.0645 47071950750.2886 52249430970.8814 54226716911.482 54747048903.8786 57999308197.8554 65772943272.9433 75792867981.7906 83305681640.3193 78216102557.1458 71335380373.4804 80643722916.5358 83715251690.4583 81504290498.1164 88231217239.371 104196898563.096 125398436325.365 146708595387.841 170208840386.276 209330881228.34 209025835551.103 222960512317.002 293140794839.058 325795387163.633
Austria 1532657935.92003 1682092116.85016 1816199711.6468 1961802212.17205 2145721110.28804 2375619902.29057 2581325902.37848 2744817978.26036 3024212933.07725 3646709999.69066 4329451630.74251 4963990236.88988 6108002260.84023 8168996816.19306 10533488645.431 11571241622.8026 12699723095.8042 14814617434.0188 18575049748.8866 23475020072.0535 26738947032.5463 24101524969.7598 23260582398.9675 22599839129.7687 22892557595.7637 24912744745.9431 32581193330.329 40094140182.8472 45337655187.7856 47919011960.4784 61095566985.3564 61808203889.2163 66499032056.0982 61586769194.3689 67296126972.6539 83102571311.5873 83284766051.4687 81567768632.3148 87232416629.6132 89275528446.6226 88754999078.6807 92156056375.8389 101038778467.909 122506816027.088 150040253797.967 164199966422.922 183150006084.244 220898841834.123 245467727688.871 192061867657.253 204069306578.947 238149659722.222 225756623810.748
Belgium 4407077777.67983 4837690320.53443 5381621192.67603 5948215317.59445 6782655019.44891 7293106123.9048 8144551113.87283 8533948955.23731 9590908967.71589 11570905791.1245 12894399438.0037 14017868302.1197 17638318656.5999 24628950422.9367 31830566759.2021 32388013437.1155 37083573285.1253 42266690248.1969 49760014929.6721 62363713795.9144 68266224961.9407 60809896536.256 57469849100.1256 56551251489.7578 57659525294.8309 57864518808.6274 73837012246.0756 89638454791.8958 103552458152.174 112113417881.492 135872660210.99 136170778002.133 148288061005.439 135414986935.942 153658931131.002 185955117679.256 180986319218.241 174313261163.735 178158479662.147 178044960579.587 181813156440.022 180989709172.26 193878223226.049 230443566591.422 274650624251.116 296892254887.33 323026917446.223 379398553045.421 428382466034.35 348735765993.418 373638157894.737 435848611111.111 416217536641.81
Brazil 1070545252.75957 1109153172.78622 770900762.54839 2080325438.6195 1354466100.63941 1685625144.93019 1846958766.74691 1764834028.82299 2032731112.89888 2479930340.73345 2975391688.90692 3155632712.75375 4249449482.07687 6557708216.93722 8424673809.91029 9325921428.94733 10741988187.6682 12776590685.3919 13404621905.8854 16026612553.0982 21276141967.8674 24828388400.1075 21435129572.82 23221079048.9002 28317692072.5941 27305943051.3572 23640556197.1798 27820190044.6076 35974382968.3629 38004000000 37880000000 35344594594.5946 42447748461.3978 46035781453.2068 51964648834.6629 55801305637.439 55139787085.8621 59421591254.8516 58500651002.9582 55230163335.3226 64329598250.8882 67434316809.7951 71078167115.903 82797855053.6237 109023247863.248 133460147904.684 156460477941.176 182671465929.372 225926235617.036 177877857668.028 232981910479.973 294453331491.451 282874928219.527
Canada 6971938200.12034 7237503016.69458 7464915852.84906 8151311702.70833 9379474862.35862 9992735995.98289 11671587968.0753 13127741480.9947 14998956980.3936 16547561104.1766 19259259259.2593 20905129728.6591 24063036670.3707 29889011098.8901 38609406952.9652 38291388124.2627 44921906693.712 48170192759.7555 53770491803.2787 64156564794.2633 75511460827.9165 80931687380.0984 79100267488.0441 84984582927.6209 99420121998.3013 100607103625.046 102740554156.171 113056561085.973 133129113512.635 142682432432.432 150422523140.213 150267085624.509 157014974766.278 170268971397.566 191950058582.308 220402215097.639 235605427209.388 251772353026.145 255613751263.903 285561015009.76 330407379974.412 311507618801.653 305349518893.774 330078509742.345 381223962736.929 428661616161.616 462000599456.963 497828879992.552 527698118158.644 384504417811.215 464132472935.59 540376767676.768 541303042433.947
Chile 567135463.991955 566595351.198462 656029553.569077 672438964.243486 730655027.074207 823644961.665589 1038664249.70839 986524114.875555 988875174.9675 1346082369.39103 1312405732.82415 1179457770.68122 1132709428.97207 2237514416.47169 3166506406.03891 1838248511.60896 2476704936.70498 2754781724.04828 3169614692.1036 4825234906.20134 6291974406.5641 5359512654.76923 4714201693.02691 4746795187.61264 4660844722.01462 4640401432.69924 5155413880.68211 6297242605.16841 8438969837.9658 10045147031.2793 10725628074.7786 11800111677.4526 13256751613.437 12697647029.7152 15574389547.3369 20907303979.6356 20667341790.5741 22427790894.5649 20875185209.3246 21605155469.9477 23233098962.732 22331856722.3375 22390879216.3011 26405144731.9744 38093909534.8344 47749260635.4835 65632834304.5476 75856266720.1891 74557072811.8876 63917967827.1446 82794811728.9102 95439359393.9632 92327698158.0302
China 2388000000 2721000000 3572000000.00001 5923000000.00003 7078000000.00002 7398999999.99998 7300000000.00002 8089999999.99997 9785000000 15046000384 20166999936 24410000064 23712000000 23282000000 26802000000 28253000000 29781999999.9998 39171000000 45912000000 47822000000 57373999999.9999 65897999808.0001 78817000448 86557000000.0001 118927000000 147240000000 171677995072 207239000128.001 207425150000 218496000000 279561125000 299409174000 365395327999.999 485003216999.999 655826577000 836887800000 1061681000000 1342206000000 1581713000000 1333300000000 1743366950035.37 2089357369251.35 2248376523481.44
Czech Republic 15404772075.5142 13182272366.2095 15937589218.4592 18750557482.5536 20393260486.7731 27785267520.7234 30181873998.4404 29592647410.6362 33368868328.7985 33153250359.7851 35833581635.1647 40310059856.0999 45205682388.0081 56308305859.832 71782838354.4587 83798539232.0534 99353716814.1593 123137210448.497 145296777973.052 116265110178.384 132154397905.759 157451694915.254 153284689056.315
Denmark 2019063422.49182 2079942081.60529 2236029168.68268 2528521058.65508 2837949005.48431 3128610274.90953 3346644772.6006 3495805516.47835 3650579660.8 4135285009.06667 4651466666.66667 5145227098.28582 6182493200.75403 8611951400.94223 10636597811.2848 11956945459.6081 12671629445.823 14194596215.3518 16637108765.8216 20571754419.3119 23152468993.4172 22386641210.6578 21738754740.5309 21839693821.7605 21544329220.0143 22920708920.0106 28542825361.5128 34787655512.1851 38845131100.052 39823807830.1551 50468926736.257 52687407175.7993 56849787114.1963 52545998550.2552 57892337200.893 68293766957.0184 69771328056.2885 66017260958.4374 66282981136.5807 70726756687.0216 74450520221.2023 75734728697.0731 82049602898.1469 96324058472.608 110905916482.225 126232676495.062 142867568667.413 162617521171.262 188222936645.397 147951172104.528 157974199288.256 179065363128.492 172713681484.678
Estonia 1149260428.36041 1732320575.53813 2571085284.56394 2925606797.50455 3624523340.85015 4170803423.74389 4021680999.36075 4800873207.11259 4979555277.85235 5190851649.72708 6808825818.28442 8787907263.16639 10807120878.7246 12212559441.8052 14751592453.4448 16896340888.4169 12392649602.7606 14983801605.2632 20385794637.5 20277258355.6184
Finland 1102793134.9799 1184896765.11113 1263061706.0589 1313353898.56821 1473319594.17622 1632982176.48405 1721749304.80635 1735527228.52203 1879667028.00209 2286393202.06988 2711046378.77166 2827196457.7866 3487225811.21824 4596305027.88967 6381401546.25012 6523355422.66042 7499615325.43468 8995130588.75609 10101083032.491 13152190505.2664 16534905961.1093 16409479195.3706 15244850129.5177 14631725021.3493 15594578551.6423 15638910207.2141 18686371100.1642 22653861761.1254 25712864250.1777 27304974366.0801 31290623542.2174 27134244963.9759 28610299973.4537 27791193921.0992 35015367103.0165 47708333333.3333 47764690654.9314 47670369946.1688 50057854917.668 50606222032.8148 53073521282.4765 51736017897.0917 54786373047.2426 63567720090.2934 75364586243.5045 81758941451.5247 94604342268.1809 112754879981.605 127378327901.271 89397271349.447 94890789473.6842 107379166666.667 100434559012.6
France 9019483361.73158 9513310197.25185 9793338485.40631 10775818755.1311 11993208178.8004 13515048018.2554 14696648797.1883 15703743028.7549 17106381715.5799 19717925360.1787 23387504428.9595 27001183852.2552 33493758127.4382 45978049499.1161 58492362247.6814 67422364999.2351 71453837749.2488 82401176785.2367 102922819767.442 127703361085.415 147729431853.462 135690162945.081 125595169178.561 125981581891.729 126935374915.56 129417944225.434 157790510465.006 183776492415.148 208335976214.073 223006991568.99 267261775689.676 271638181606.79 299417719950.434 274940931202.224 301415406427.221 360871467998.423 367834465957.174 368531242975.95 388776851234.156 383834008097.166 382167864381.795 379546398210.291 399374176548.09 464381489841.986 537428370987.068 563188330099.985 609570954197.564 693536333998.505 763136192185.154 612193214353.685 650688157894.737 747613888888.889 716860375417.845
Germany 34316951411.1593 38252931850.0631 45853512393.103 64288338634.2266 85347924124.6837 88228720783.1465 98714567475.0691 113470819256.1 137249146870.792 165101185832.38 185972433627.942 169386211790.565 170329800580.127 164351046405.35 165561563718.03 176598360053.347 234067159940.443 282183510365.101 310579389878.178 327860327011.379 425190795113.336 464820271066.588 495754539762.054 441476398911.629 490490538748.945 598949092397.98 604458019235.768 591044439431.536 622585306213.182 626603451949.712 629767827529.022 654344519015.66 715763222284.961 865778781038.375 1051001719717.15 1142951300800.88 1321146447115.38 1567684681059.57 1744885926685.47 1400430371622.7 1563934210526.32 1835319444444.44 1775559269735.15
Greece 378479573.556429 434113891.909364 482808836.798816 556304610.630942 570656727.438363 635675095.953843 887750577.212658 907858461.049097 886879620.248618 1021175822.97038 1212674850.20152 1393467286.90774 1804873331.90891 3044818162.87245 4219246747.3092 4722864183.22595 5123884223.65909 5921118816.25652 7076153904.08684 9678589734.62898 12857012525.7006 13108524072.6437 11004242447.3125 9534596592.51045 9445451262.56052 9032751759.67612 11679572988.0671 13930766523.9111 14566195925.0277 14779733535.9859 16937228217.223 17479332243.722 20245736702.5 17895282558.5771 19720018719.8042 23116675104.4355 24313791460.7789 26657052280.1168 26995509151.5529 30025309916.2088 32009044155.6265 32286419084.7734 31848316094.579 39938262245.4198 52726593034.794 55721286760.6825 60589002752.3362 72659329542.1262 82427433920.9726 61838607649.1679 65018226201.3158 72565939606.9444 67252839600.1543
Hungary 1229200000 1475350000 1670150000 1811617864.2075 2413952225.84148 3346210793.24019 3995614973.26203 4511597938.14433 4856909200.24053 5823542336.33071 6366351606.80529 7863153456.99831 8664289556.59725 8982106950.31327 8784994767.73283 8453385411.58091 8366779414.06047 8702568792.0858 9416571210.38564 9886619593.37188 10520753095.1948 10511123024.8307 10295134878.5697 11320129738.1461 12109774202.4612 10536347243.7401 12414722051.6181 20599607583.1897 22490540245.447 25758710132.19 29609956390.2643 31180923130.9848 34605680197.2741 37950720363.0176 41991390788.4022 51297967068.8937 64565573480.7539 72753983941.4778 87487969960.5495 110657147914.01 125946866405.857 98254394794.2834 111324319515.245 129199244006.764
India 1652701652.70165 1688401688.40169 1757701757.70176 2072702072.70207 2104202104.2021 1969760604.7879 1900000000 2022666666.66667 2144000000 2170666666.66667 2361333333.33333 2469904478.21364 2878178662.67099 3599135190.13099 4808425715.98734 5560809314.24004 6868170799.92542 7754744525.54745 8670308914.02806 10326361732.2038 11439612302.4294 11485632693.4384 12009347412.1516 12741363287.4056 13330716058.384 12217447854.5989 12937864153.5995 15638662913.9839 17899838821.0914 20770696527.6145 22639774911.5525 22943413669.2237 25486028725.0423 27466549052.5332 32361236075.8335 39068801410.5447 40802985845.4027 44459206100.0225 46426519477.1231 52544451068.2487 60878396865.5263 60963546808.3583 73452751289.8689 90838365703.7158 126647860366 160837896187.155 199973922363.783 253077528108.493 288901732847.276 273752028721.782 375351687886.032 448717644624.291 446027703580.268
Indonesia 549939020.978352 850449461.653154 831624097.766871 1298928726.96986 1481077568.11673 2030161416.63614 3612714795.79759 8112644905.33012 7718352535.7494 9647266833.27229 12023764533.0506 12441087132.0365 16846773884.9321 26664131298.515 26854619167.2088 23966056268.6223 22488397277.543 22417491987.622 19389868435.5614 15601609327.9591 18173190917.4787 21110163794.2419 24640067227.7087 28982530241.0888 33063805666.8527 38801526291.7036 42274398287.0896 46896633859.5543 53185313144.4533 58717199880.0858 60106040385.3565 50555727069.5257 49720260523.8385 67621169359.8417 62625866713.1114 63956799298.5592 71553141756.8334 82744350707.5308 97387622312.8673 113143428508.797 127226102177.005 152095145102.519 130357767224.835 174323240916.275 223001638079.456 213002974177.365
Ireland 572620662.958074 670336524.244063 676034211.037935 756372067.621763 856651651.56988 950948957.23211 1072019667.94679 1173664975.39725 1180992496.30749 1311077535.4825 1463713690.36734 1658160397.2683 1966644612.86461 2560796206.93664 3027920385.16093 3647325640.19887 3939026781.61046 5004431060.6817 6588244995.55387 8204573017.1627 9707520397.69243 9021203697.76318 9299176559.31225 9810870517.60771 10785217987.5896 11564973710.6744 14185836092.775 17897916587.8652 21128789766.9887 23265556339.9914 27140140040.4601 27844028548.8644 32861556243.2523 33420880629.0752 39043675830.3682 51146096209.596 57252679320.8165 64514004696.7526 76575759993.2713 86038693320.9035 94936472772.2499 104798315713.647 115405761007.905 132248009446.953 155455759161.374 164808960477.292 176514013715.265 208569738093.283 219988913524.005 203334598162.377 207644733289.474 231894668293.056 227225071283.106
Israel 344026101.555445 402186322.027911 462145156.73934 558013933.880237 603774352.812745 690668978.991486 793669323.831432 928865887.475582 1180003378.21467 1332003813.37453 1452289872.02547 1713575479.40009 2247236779.21748 2777320868.89993 3781396413.12046 4026104110.82638 4858956367.12092 6139486024.8668 6751207114.85472 8306568203.63847 9535564911.97455 9858100422.8876 9374171317.41782 9706801161.22716 10569216827.9278 10773210897.2852 11717656938.1769 13908468425.3087 15407179058.8735 16416718792.7614 18209998320.202 17681980100.3693 20147208054.4116 21390056619.587 24354553571.1322 27490119751.949 29613685666.6488 31787557734.4276 32886239835.7938 37815059647.6678 46591126480.7593 40461516513.3034 39334501245.3037 43401111086.7131 52308567603.7483 57261363636.3636 62481709232.9099 72036707967.1868 82418896321.0702 69168934211.5302 81015779620.2193 91671604248.1834 93197697035.7115
Italy 5047144627.96261 5736466839.25696 6383932340.4554 7020447958.88853 8097991291.27695 9713521917.71206 10826008275.8316 11734429394.0077 13403095880.0386 15382275392.5625 17266418835.1921 19504993757.8027 23795816733.0677 28381600797.0774 37121464721.6433 42830367734.2823 45231681786.462 55302830809.7433 68585443759.9817 88492892099.7437 96741125932.6249 93702265372.1683 90616034359.3414 90458949515.5533 92360039673.7933 95872832369.9422 120276659306.403 145503884075.291 157380243975.007 172673863957.099 216583710407.24 213191197128.141 231715475255.302 218147409868.34 241412824207.493 291026506596.933 312550633705.609 302151432469.304 308034571205.531 293345301512.892 295530035010.135 301803758389.262 312200263504.611 369762528216.704 437176311361.929 462167960005.969 517319395188.555 613721569368.141 656574358223.166 501331540349.771 542774868421.053 632735000000 608732836204.68
Japan 4751050160.35556 4964487441.06667 5726760686.93333 6281142818.13333 7761341098.66667 9565853013.33333 11173559591.8222 11949693701.6889 14824161644.0889 18178168877.5111 22147887130.1037 27114974296.2778 32448394935.6469 41804866960.0735 62880126376.7247 64337923902.6037 76601287374.8689 91066128032.261 108646121763.964 117640388648.315 145902668779.149 172997373333.103 158614484014.547 166061063857.535 190568490717.193 195147241965.494 227662417089.421 252164583615.241 294439756892.949 308879466944.86 319309156913.215 349239288642.576 376388413778.418 399875734088.364 436633016266.86 482857677472.581 456524277181.922 464058040728.683 421892008956.093 450944983091.44 514630377996.669 434656283402.549 447955147223.02 510877356415.531 615047184198.608 654356820120.125 704558078745.303 773107495286.784 858851188575.741 639244801491.075 833703577124.63 893226412730.234 873963692419.524
Korea, Rep. 122908791.846489 124345084.000086 134281893.656391 179045024.494834 190475229.79283 250522666.455105 381387000.549779 518378866.549176 730901879.404742 966743275.9979 1212648119.52602 1474866772.28864 2081498638.29571 3926993372.16309 5140554305.63453 5769421487.60331 8869834710.7438 11517975206.6116 14527685950.4132 17433471074.3802 20468202097.361 24491432095.5024 25324451496.4163 27865291653.2388 31103129109.9035 30891358819.3375 39672584945.2607 53582065963.9909 68271152610.4967 70975188395.4368 73735870916.6949 81154564668.9848 87717671171.4597 96069243898.4888 112793204306.429 149076328652.742 155370501584.934 167237120121.099 159465621075.465 173989081610.336 205695161632.595 180342217987.746 190781078899.2 227692281870.746 295165630566.13 331754872475.882 377701274625.834 439870649764.329 493725965246.586 414780058421.37 530567423718.229 624493745274.965 638247332647.743
Luxembourg 624460982.263862 626766230.058913 606449894.580347 629020772.213136 728221194.984743 764941218.351552 769553779.344538 787253817.353568 883320559.232941 1070671189.53083 1321516986.60142 1365381556.38047 1607561222.53004 2377866209.31861 3332586251.31261 2945791659.296 3077095150.63141 3356913180.07869 4031716673.36625 5116128497.73587 5434865033.60163 4466033537.9323 4177796381.30735 4163840106.75183 4576208372.37685 5063126090.05492 6767747728.64359 8188648156.96763 9417307199.21447 10318157738.8596 12864795179.9588 13912340464.9187 15448559882.1166 15896344480.9408 18254649529.1935 21996852764.0941 22872833876.2215 22388137122.2373 24677928428.5397 28448433837.6305 30404274921.6879 29616107382.5503 31756540560.8884 39937810383.7472 51930491143.7671 58661766900.4626 72279182729.2788 90271652993.685 99511187607.5732 80059124003.4285 88325657894.7368 103361388888.889 97824376446.3872
Mexico 1109119663.47283 1191207822.24962 1302503660.59118 1411095978.97303 1532720297.16069 1667319975.155 1816951972.92531 1824071972.81921 2066335969.2092 2451095963.47583 2754439958.95565 2995039955.37043 3643199945.71209 4650159930.70722 6054239909.7848 6067119909.59288 7558155885.1105 8442477605.5747 10732745433.0612 15056293605.7723 20806478220.4295 26030531293.0229 26633315107.4564 28288293322.1439 30526866343.8181 28436327928.1477 22445888630.1483 27348986735.2641 36496760668.4775 42358818602.211 48866102543.7007 51459973288.9217 55406028608.0771 61187513905.643 70326125808.5807 86544697538.7109 106220510221.956 121248422235.949 129262258255.264 147656128263.27 179640159127.859 171349823264.414 173988742865.191 177580295076.481 202070169738.82 230168570832.125 266391085907.195 289450483815.624 306620694447.869 244251910648.054 314034851421.914 365518862765.807 387306924467.948
Netherlands 6002580390.69374 6289121521.09683 6729239598.63781 7315166177.64235 8341973000.1328 8990516463.87012 9524528796.23659 10152342093.4039 11387867501.4142 13375537336.4185 15823339623.7901 18595864661.6541 22797995056.3032 31354248778.1807 42241167308.7958 45752004182.642 50941823637.2729 56082427942.8931 65702790792.4221 82639789080.5229 94561072932.8309 86586593658.9243 83619707848.4773 80503436028.1059 80766483516.4835 82811173036.0934 98032919589.8543 116453437771.976 130222990299.922 136625792372.441 166466174512.889 173446487505.893 186182957393.484 178758898908.401 199429713040.32 248722206972.276 249247058823.529 244737971538.288 251906243057.098 259383123801.406 269869172655.242 269544519015.66 280867683041.596 339162528216.704 404923233564.905 444526936278.167 493607780806.658 580628163331.226 664213571611.675 546021840873.635 607522368421.053 697768055555.556 678301619953.716
New Zealand 1435674181.79312 1780777841.89267 2341294360.71949 3073084736.32948 2873688637.61721 2971975378.36006 3629421278.25409 4039082650.34067 4937532399.66555 5935350095.16178 6695590619.57151 6818578802.76413 6686901675.16387 6860582281.80862 6798573576.68775 7094477749.36061 7967069602.87284 10282048777.4683 11569250293.0757 11301684340.4155 11899601577.7207 12174301519.2438 12683242083.1561 13957698224.6557 16551374375.725 18124555300.2125 19214819994.4498 18095368461.199 16088919701.0369 17516470932.586 18177388113.1164 18402580688.0964 21137960303.6128 25060097538.781 29435072114.2857 31137759809.8592 31602045337.6623 38364680338.2353 41019370443.662 33606522712.5 42684230093.5252 49229422204.7244 49044647921.5623
Norway 1872051410.90351 1968595448.49264 2048957258.75685 2243828466.96984 2578852639.18108 2878470124.40364 3114302393.15039 3500743458.0473 3846668709.02637 4109465549.62966 4674151955.08827 5070933544.97654 6067059287.81761 8429532762.14923 10819538964.2038 11869559394.6699 12928617245.487 14231238846.6235 16740362054.8233 20856025749.8865 27550615484.289 27207770711.7345 25657576696.6223 25431719752.2066 26225816332.782 27462313311.3107 26430822075.2701 29929499072.3562 33078717201.1662 38304004634.6586 47221272584.9482 47793117277.7615 48588784294.7944 44804978785.1877 47467411017.9098 56528602096.2243 65313808180.0986 65441796024.5426 56898781990.961 62649374294.7995 78315344588.6069 78221915766.7627 78939226934.5425 90697014208.6382 108689731086.528 134063639891.347 154282564595.928 173600526812.325 212250000000 151688922178.066 170524668874.172 206003392857.143 204495401804.899
Poland 16909149668.1399 17991932779.9832 20001107538.3575 19707991901.9925 23435002483.2333 32261709374.9227 34953822187.6043 36786621494.2869 44922023364.2171 40593782375.5832 46457604226.347 51520310706.1726 56748357242.4713 72224793524.4325 94769031397.2944 112705997255.43 137881063658.34 173349477717.136 211226548231.778 169955450145.829 198418145040.952 232414827562.934 226068652133.866
Portugal 456718078.528275 460401266.375809 559847816.566087 622462235.059748 906069893.904269 1051620437.73751 1164826229.43768 1308614738.06721 1331872602.7528 1425767410.21282 1551596491.7866 1810581829.89949 2401417683.78634 3164293900.55429 3691479406.54094 3096486965.40494 2781071640.73906 3098911198.77241 3707002769.75735 5650778691.92021 7067569002.8545 6509971648.54443 6322781955.32286 6696748922.3937 7368430268.80915 7940001033.55702 10085557997.6512 13190314327.0696 15593540169.7859 17878282622.0602 22991201443.3752 23721343140.2965 26351145173.8006 22452730698.1863 25089155731.8519 31663659280.881 32965687548.7393 32102344196.6838 34310997328.5842 34239931813.339 33940206375.5298 33783355704.698 36511951816.2996 44730135440.1806 51994685639.4306 53062726956.1757 62363621994.1014 74589605249.1111 81739920166.9901 65619308654.8039 71196447368.4211 84806111111.1111 82131781949.0872
Russian Federation 110935023419.783 93864126233.5359 67601882145.8763 286811344080.146 166212955942.471 109669623713.859 115848176166.281 102134748920.303 100138288677.615 84595569294.1783 84670999187.6523 114429434767.153 113116215289.681 121649122807.018 151697510751.987 203415480735.856 268951741205.586 333908278474.495 392044033024.769 520003701781.281 341584673112.73 445512964893.386 576567394209.118 593112327003.54
Slovak Republic 3065643829.48777 3239005020.65375 2817937810.7215 3110349410.75484 6077413253.42369 10036769104.5004 9071314096.18405 11677042325.8816 14586752941.1765 14547182509.5057 15231710660.4735 17322443226.3117 18317129767.7392 20235659664.6398 22045544519.0157 24634254658.3851 34765496613.9955 41799443754.6561 46764126352.4437 58299657508.4682 73053336983.3014 81724624285.9235 61833157821.6171 70748189403.9735 85487906588.824
Slovenia 15775618505.8601 10586760793.3261 7907146957.70697 7445672629.03567 8472160421.8306 10385183046.4131 10555111514.3626 10475568622.6917 11106683935.6213 10536643372.5719 10728770110.8816 11311737679.5833 12743052382.6095 15683064734.0939 19561230184.2271 22208563968.4002 25914292993.256 32905339926.0881 36663789645.5251 28643633566.2684 30689633907.2848 35815262718.9324
South Africa 2256441235.92608 2378829411.01977 2519505297.20568 2708010719.47892 2859940719.56769 2913398746.20586 3123398841.48982 3385198468.07469 3760398676.54469 3859798368.02457 3904598350.1225 4325959998.61016 5260799083.84496 7213681818.24435 9997394908.5941 10231130199.5314 9840550212.243 11914000578.44 14669399692.844 19695432699.6573 28496454133.6167 24620601473.0484 21186582556.7343 21269439210.3916 21696385193.3202 21068903003.6871 24304684830.1466 31481154327.7621 33355790671.1517 33343824056.6451 27148933141.5863 26149497450.309 27855752303.2406 29312905370.6537 30010716729.1487 34412206765.488 35543982800.1874 36601648484.1996 34450654234.5191 33741636819.1477 37034202453.3268 35694800210.744 36578052615.1214 46899770525.5484 57889752492.0884 67643778942.0634 78317824613.9885 90077093237.8947 98005339806.4129 77556911881.0454 99398844053.8149 117659751183.479 108595055663.44
Spain 1010042253.47371 1102919716.34887 1340088891.68918 1471112407.84921 1880768223.8955 2028377185.10014 2554121088.92926 2706181739.62414 3326528831.37979 4084235531.03191 4951473712.94034 6040885950.53844 7854050140.29941 10431251151.047 12770485933.2206 14143970874.5554 14829093398.4815 17477067477.7371 22195378315.5039 29283885382.8756 33122282852.9111 32883208030.3797 33132599065.2678 32470331292.9073 36506734012.3332 37561118676.5707 45538556717.6331 56256480629.4933 64808495668.9932 68565691384.0531 84012715927.9814 90577370597.1387 101694025613.297 92588263495.6627 107303441620.724 133578863090.472 147044529094.969 150631818181.818 160218287114.378 164795440017.047 168594066703.519 173728859060.403 187539996235.648 232600451467.269 270934296871.605 290239019051.883 325074234043.914 387785743418.766 422187717435.09 348189813612.135 376414473684.211 448218055555.556 431996657238.365
Sweden 3415028157.03131 3607782140.77514 3835863778.12531 4158979760.9428 4718441099.53868 5083909727.98649 5419220178.50277 5796451759.21931 6284653669.00046 7229407613.25469 8543261424.26351 9414541836.55553 11024063497.3963 15156046069.654 19793891066.3603 21719570348.2491 22996854840.5611 24086933238.1292 27442514108.6644 34917310069.7441 39423349725.7424 36874629695.4615 35184159424.4421 35461386965.0846 37574530331.9713 38074245400.3417 46850889999.4385 56249447984.3543 63034991513.2524 65867626301.0129 74693350003.3791 73105911533.6916 75398021910.0931 66159262019.169 78476412649.041 100712993985.953 106603787652.848 106513510327.575 109657228392.81 111544950619.675 115032306651.241 105274902944.109 111354407369.751 136969813140.744 166406763470.402 179476494997.384 203955680547.555 239906373496.953 260235165602.1 194601519241.372 229049653259.362 267371494607.088 254230110701.107
Switzerland 2644513819.75737 2912465340.66224 3191279862.32459 3477336462.54756 3847882105.97612 4222049139.93529 4637253682.40381 4947449841.9949 5593189787.38954 6428426456.3666 7217428495.8952 8238779254.96793 9949344821.66316 13502341824.0456 16368356322.262 18120472567.9576 20272493906.1084 23622304881.684 31623320611.5108 35789016095.7695 39673325425.7922 37231580417.4728 36904732117.9136 36718848530.3225 36747219859.9821 38662407458.7929 52641825063.0941 64501860439.9142 71220169273.5598 71636229852.6805 87046352042.9024 85484269912.8312 90805901280.7567 89487811456.4158 98284881175.6964 114092162580.972 111814466461.974 106671157937.022 110690439316.457 112789034324.324 116319038653.482 117278389227.898 124043278756.576 143570631478.429 168571313832.73 183071433637.707 205917829969.534 244930792452.327 284520942590.182 256603743028.471 284950909868.269 336941385084.27 330093634600.619
Turkey 292606783.510358 406807031.017544 497208593.465887 429407421.62963 497208593.465887 542409374.690059 576309960.608187 644111132.444444 644111132.444444 697444465.777778 759043472.695652 867868865.857746 1226855051.30742 1809045873.0742 2042292010.62684 1976249804.73619 2492742725.72105 2239195737.36252 2702166218.9276 2878237861.31222 3550974619.63755 5851931876.67575 7657846907.48248 7693307308.23172 9362454944.21294 10663983548.8895 10081312588.3738 13582253228.6478 16947657046.4372 17360346517.8538 20138041278.2139 20905815687.1581 22897327899.8292 24670588884.331 27918206081.0811 33713478165.9389 39094658476.6585 46664617511.5207 57459512850.0192 48551401623.6867 53574401791.4267 53785580939.9478 58638960323.7792 69674957692.0514 92361269028.4111 105557060881.215 120354555827.791 144466001995.548 174608489435.267 143292027630.055 155069447984.831 185765065347.906 208684962005.8
United Kingdom 14616021507.196 15258543540.5409 15655395384.6658 16511191128.7229 17491172417.9944 18622333928.5712 20082873495.4395 20542668837.4195 21672959115.8152 24206781922.7881 27868972239.6148 31708741104.3814 34299811283.9043 42269075069.8388 54069628150.6807 60059441363.6845 63726275414.7984 76337527214.9791 92021896598.3996 117551243924.381 147066505013.085 137408143203.975 129124440712.096 123368509645.473 124307260398.047 133482183287.11 146141420634.047 177551773682.026 195294973741.788 203112952341.94 246837713068.182 249924162257.496 261730431730.432 255094481103.779 287858891949.801 335534164431.119 362137285491.42 392233136869.679 387934746604.836 392104837404.951 407880163413.527 399786958399.309 419656774580.336 478499591836.735 559927130250.101 617898610540.402 713144932629.483 761379188910.143 790045701385.748 626513625550.887 688106153846.154 794974193548.387 780881516587.678
United States 27005855744 27558787072 29003671552 31046887424 34971889664 37072625664 40911106048 43436511232 47881203712 51921788928 59700000000 63000000000 70800000000 95300000000 126700000000 138700000000 149500000000 159300000000 186900000000 230100000000 280800000000 305200000000 283200000000 277000000000 302400000000 303200000000 321000000000 363900000000 444600000000 504300000000 551900000000 594900000000 633000000000 654800000000 720900000000 812800000000 867600000000 953800000000 952900000000 989200000000 1094300000000 1028800000000 1004700000000 1043400000000 1183100000000 1310400000000 1478500000000 1665700000000 1843100000000 1583800000000 1843500000000 2101100000000 2195900000000
Country 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
Australia 2611714637.69739 2952178295.44182 2512039422.10774 2974577220.29343 3270243028.33464 3959009967.52156 4124762011.42345 4222197334.52794 4730652928.65942 4882965617.65035 5455258147.60891 5839399708.81398 6251168224.29907 7062139654.06791 11784819454.6794 14352041513.0411 14071599647.044 16180316586.373 17304308594.6312 20742928547.0862 23893036211.6992 29641239986.0676 32685644929.9349 27726719700.5147 29067197971.382 31256424023.9319 32979854504.7566 32383536262.5728 39316065192.0838 50963276606.1396 53254328587.9184 52891452790.2048 53566869184.0345 55920460933.1085 59734347976.4787 73036828036.828 77569802731.4112 81973704805.1338 81366750322.1868 80118435894.2223 88889656471.7704 82996136095.3096 81305985768.1038 97950495049.5049 120022051500.925 142947677041.046 157706648697.215 179557195571.956 231133924474.668 204505132234.124 228035643756.112 272132446797.438 321907835541.805
Austria 1533588047.51366 1601412624.93473 1721989636.40706 1914159091.78538 2162849118.67194 2445451298.78299 2745531718.66462 2849036541.99729 3073420375.16241 3514855808.53937 4307242099.3155 4981129477.50427 6157470593.40621 8290426302.42582 10930733100.2817 11647136482.3799 13655802715.3486 16994821413.7041 19338081114.3751 24462465259.9074 29405680706.2327 25646251944.0124 23537506654.8358 23536051784.8935 23455437727.8041 24885806065.4429 32342700315.4574 39829148889.8563 45551020840.2987 48229411336.4535 60770866513.3729 62856742486.7413 68598561232.1563 61754265941.086 70230626430.5505 85371408489.1497 86927477255.0039 82631975420.0023 86002242107.6034 86783471127.2107 85398920213.7461 87949404921.7002 91159689440.9938 113637234762.98 139029824986.186 152048775058.449 166704150206.802 199411054448.304 221626841469.22 174891130427.051 187670423684.211 225716426388.889 213059697865.775
Belgium 4488686802.63416 4935914685.53765 5383141329.19941 6084755797.67895 6835605753.21234 7297193143.13369 8275773594.60897 8450148124.74139 9492309938.62933 11307889126.1336 12318530040.0561 13448626125.8303 16483539509.0919 23742669908.556 31651059543.3727 32304025142.4004 37012742959.0478 43034412480.1983 50828343502.0387 64790213548.672 72407862544.819 63427658672.8922 59415369279.9857 56413877420.5938 57364886025.7827 57144817406.5625 71245297019.1466 87083916524.5143 99793301460.7584 108688462660.038 132540201005.923 132492364363.605 142450448163.529 128215066747.17 144742660518.595 174767378215.654 172323127035.831 164907532701.849 168442987330.518 167451523545.706 175001842638.659 172521700223.714 179363824581.216 213598194130.926 256878558169.277 282049942794.608 307782437485.965 361735907521.919 424042186985.022 335926028314.507 363764473684.211 431594444444.444 410885831833.376
Brazil 1079376697.5971 1118303072.09254 1033970123.78627 2097486971.17854 1204326312.92167 1210638004.88226 1621508406.26918 1764834028.82299 2239326008.02216 2454948706.32527 3153304281.77409 4004245628.3267 5177234175.22541 7532763893.34577 14596797397.1813 14233481659.1693 14401534171.2811 13948797703.5527 15791774016.4342 20642227951.643 26571483281.2489 25827534747.7938 23307743171.0553 18314364418.7696 16563864377.396 15818492271.9478 17038985216.6608 18211636976.1545 18807996682.174 23242900390.625 32160000000 32236486486.4865 32749375418.9263 39867924829.2435 50042233693.1018 67475478842.1548 70248731469.5055 78585926426.1701 75372441765.1788 63475453413.808 75699371412.9544 74716435677.2383 63446040465.3861 66711732206.6948 83289572649.5726 101627773212.818 124852941176.471 161893968251.251 222783523894.352 180475100254.559 255083666760.733 312616577373.328 315070997093.378
Canada 7452527622.81307 7359338827.29246 7469254669.64448 7792434890.44751 8874461306.16442 10055817479.3005 11653023567.8002 12469546116.3743 14139540131.2697 16467693332.7201 17064790889.0803 19300851653.7928 23056874431.7608 28072192780.7219 38388548057.2597 41283916633.897 46372210953.3469 48531264692.0545 52970982729.9027 62817995560.8673 70528566541.2248 78749687213.2788 67107886844.4516 74114735475.495 87184773376.5732 92330281948.0044 99159409859.6618 108081447963.801 129289835053.222 142502533783.784 149660610215.975 153699048616.566 159173492181.683 170275947600.961 185276801405.975 201557854852.813 210893289328.933 239253936154.846 243256488035.052 261360301541.361 288703790990.506 270426136363.636 272924870961.575 297520519591.749 338437533627.461 386437908496.732 429911139320.851 470212270738.292 504811440995.652 407075496457.003 493759829411.349 561398989898.99 576307045636.509
Chile 661658041.323947 755460468.264617 749748061.221803 794700594.105938 773634734.54916 760287656.922082 960764430.980265 907602185.685511 930706047.028235 1160415835.68192 1259200095.00696 1285936597.20105 1526277959.37761 2534826063.82569 3061417203.80983 1980814755.19348 2049961685.82375 2995496836.3974 3684459898.42072 5412080756.83221 7438435984.41026 8733743261.53846 5172972036.92791 4214608598.24851 4874086275.2234 4239040081.16374 4613263878.0905 5689699649.05884 6715444267.58092 8700382094.0251 9641147917.34995 10115102227.822 12526187324.1767 13649489076.3788 14656811366.5572 19337517957.5069 21946624784.7285 24182766926.6175 23467583479.98 19946523055.1515 22670575564.6627 22093374247.7418 21574883562.7399 24286233855.6647 30595418148.3317 39293074978.7606 45644844689.3306 55318359682.6906 71014855369.6851 50895026751.8746 69091974635.268 87205464437.3091 91352816772.6969
China 2474800000 2974000000 3844600064.00001 5173599999.99999 7483200000.00002 7361399999.99999 6781800000.00002 7442599999.99999 10473400000 16673200000 20859000064 23426250000 18900000000 20710999999.9999 26748000000.0001 40754000000.0001 37171999999.9999 38879999936 49973000000 52749999999.9999 46705999999.9999 54297000000.0001 73819000000 98349000000.0001 111570000000 135282000000 154127000000 164416000000 163589000000 189798999999.999 250687640000 271324953000 328012656000 448924240000 606542934000 712090100000 852769000000 1034729000000 1232843000000 1113200000000 1520365283469.72 1907494701685.5 2016525506399.21
Czech Republic 14294234672.3325 11257523898.0215 15442981844.0554 18207148568.674 21000833878.9117 29878975131.8764 33534294011.8253 32293714493.0242 33694631028.4118 33498730808.4497 37092510784.9361 41284776569.3603 46118275327.5315 57453507745.7549 70782283874.3568 80245409015.025 94884955752.2124 118334647609.66 139909607498.535 108310860440.714 125500471204.188 148492259887.006 142285480781.509
Denmark 2144751949.42052 2242566802.70352 2539599663.46956 2560816359.91816 3101840340.32876 3368140183.54779 3608176225.85532 3836730615.59398 3918940842.66667 4561979528.53333 5267200000 5661096373.69888 6423092973.393 9437308868.50153 11822343270.6033 12626605408.7919 14981968569.0653 16310634328.3582 18341130816.3783 23038015586.3904 24280061747.0147 22120055029.9015 21764317603.5716 21021651175.5057 21141011528.8801 23068494960.5526 29638487208.0089 33761238542.1692 36260714550.9916 36912806763.1529 44220663801.1828 45258031736.1057 47477675982.8366 43134070543.9627 49832405747.8854 60853384263.8869 60718781795.9198 59758649405.7082 62611031518.6246 61944611679.711 64788633073.9444 65079660691.1136 71900008866.708 83034291179.0154 98982817731.7536 113592333385.027 134147387325.578 155504160773.004 177312661701.447 135829072519.945 140604804270.463 161574860335.196 156700906344.411
Estonia 1219417317.84053 1982954944.26804 2857052185.06892 3444907631.92098 4173627378.50941 4731905922.63228 4301473204.77307 5005538588.53879 5133978403.57942 5729289331.82759 7545903135.44018 9636328257.37399 11710893962.3439 13933530248.7264 16781576611.1262 17856996537.1516 11323506074.2412 13665197036.8421 19555547900 20226225444.8444
Finland 1161879537.3761 1266154793.56422 1359290844.07117 1336393601.16152 1646434389.93369 1807643813.28067 1899849594.91853 1854024152.40695 1785111623.07048 2243649054.87256 2901994623.93029 3116110522.26365 3558591513.91246 4849296219.67562 7338853378.99124 8310974624.21206 8192029543.00662 8555407997.63907 8979061371.84116 12688139215.387 17233025183.2961 15896941306.1449 15153570988.035 14637062339.8804 14340126632.3704 15264773599.386 17888810696.6925 22414446097.66 26382373845.0604 29510877095.7462 33448919297.1544 28345831495.3683 27714361560.9238 23814926616.0092 29278315310.1878 37922113289.7603 38783329018.8972 38566029091.7421 39572763684.9132 38696995525.2504 41942141146.1212 40059060402.6846 42303783173.3484 52363431151.2415 63032289707.1514 73746455752.8727 84788011154.8647 100145352418.024 117172886073.168 85489474788.2524 91757894736.8421 109265277777.778 102548212908.203
France 7874771893.32456 8433174749.89666 9246854519.62353 10665733809.0798 12384789420.9009 12845806484.0531 14652769102.452 15654898773.4924 17479359120.8384 20830196886.8352 22476910357.8599 25254054693.9742 31682184655.3966 43914555097.2304 61118930714.6754 63432002447.6059 74399754165.5285 82530623161.2731 97540988372.093 125250231267.345 158610835144.365 144902112251.056 140185747080.547 127770978569.584 126507693462.433 131848153015.039 159288284875.462 194758921750.518 215959035348.53 230946843512.235 278305143958.559 276703871642.832 291269021065.675 253939193884.642 282325141776.938 337704034695.755 342350301320.682 327678129916.835 351556593284.412 352771468144.044 368965450525.152 364334765100.671 377222849614.154 448343115124.154 529116611722.635 576717405362.384 633153984050.5 733519198289.714 822738491961.768 660059207354.937 708351315789.474 829987500000 774776292105.94
Germany 37397102586.9878 42533468746.5509 50683837853.7486 68048923101.6433 87083241243.804 96360051143.7729 110237072247.688 126267937833.777 151211400783.849 197072381397.959 230688503131.989 201139469454.643 190830986032.338 187501258869.831 185754957549.375 191171960511.943 236763351186.186 284939713683.864 313855659186.081 334980125857.368 426286543953.412 471655863288.156 504107701941.14 437998343783.272 483307219476.919 583949774805.514 581050168962.828 563219039025.491 592653106591.086 607873428510.548 623963515754.561 617046979865.772 625512892904.197 770801354401.806 913461598157.357 998706660697.408 1158000905736.88 1335038692211.46 1516622111546.49 1238283903573.42 1379460526315.79 1646916666666.67 1572537927487.79
Greece 718524774.933093 795769616.410426 870232756.735945 1034173117.83374 1228103930.15993 1492364903.51562 1534263794.38568 1594976536.9456 1763377360.79256 2037254207.88456 2303417336.80234 2547069908.4533 3146789428.6307 5169450527.56746 6205192291.13941 6955995715.92045 7470578712.47964 8613297184.16664 9930101184.78868 12769192738.2299 16527437757.1193 15518392302.3281 15494812387.3647 14055110652.1978 13321768440.1408 13352757285.5318 16199085674.3084 18286589773.8389 20455119418.15 22638148256.184 28568232992.0791 29526791088.2393 32037428115.8248 28783714336.0959 29152944294.6961 35743302056.9438 38663462696.1475 39996701990.6626 41910736410.1418 45307081374.7149 49274822184.4468 49855013828.4783 52203562199.2681 64257828807.5991 76275642668.9408 78024018435.0594 90528389931.016 115846834619.88 131910649294.32 98635145715.1073 92131496552.6316 95998406255.5556 79780639301.8771
Hungary 1265500000 1361050000 1798366666.66667 2187351294.1242 2327868259.13862 2945849997.4472 4420363636.36364 5322612189.20558 5396368009.62117 6454595760.26366 7878155361.14652 8522062956.71726 9142734188.88803 9221943756.37476 8599990900.40492 8051541841.61704 7723952750.16912 8275560728.24009 9752970054.00098 10012546570.6277 9753964659.40459 9539272009.02934 9431769638.47797 11565133645.3661 12119185733.4506 13702717999.4187 15076511647.7035 20462601087.1006 22184886666.3755 25190759635.4178 30218794940.9597 32395175964.1571 36205808957.0751 38495128059.6885 43221457102.5996 54508384354.7523 68235370229.5568 75078376110.1299 88517586387.1857 109443816456.472 125246304760.429 92102542728.8825 102961589881.697 118897344076.395
India 2530502530.50253 2337302337.30234 2543102543.10254 2860202860.20286 3210903210.90321 3103737925.2415 3060000000 2981333333.33333 2624000000 2356000000 2421333333.33333 2695662885.36266 2650511496.54511 4039170799.94913 5992038199.92268 6545391512.02319 6280812977.81093 7611094890.51095 9045636411.64165 12498116945.4275 17225935193.6904 16584509999.72 16343430846.4601 17140086468.1402 16391245215.2943 17776627692.3915 17486411449.5757 19477194741.1034 22111443702.5097 24133354005.2713 27132072318.021 22941374399.6901 27639649645.3543 27419361695.344 33349523453.1137 43318366218.6494 45357245135.0908 49607445615.6089 53431626996.5487 61314667025.6341 65124164122.0956 65218416872.9896 78498604686.3945 95071650073.4454 139310175989.139 183736200857.17 229955027127.372 302803955059.529 350926576847.537 347177846006.843 449972181019.078 568000222585.857 571304555590.953
Indonesia 953550972.372637 1099479610.48454 1231818978.15951 1445616429.58904 1582044516.46771 1869915631.96145 3199036087.82651 5571276948.04819 6758602293.0506 8465084564.04819 9289493965.41687 10699920765.0679 12432189977.4918 15766759183.3048 22214765045.7942 22786429640.2415 23784175003.7312 19342944414.1525 17860217134.4638 16401727327.3338 17006296157.5087 18725515164.1951 21718471067.1013 27157275971.7786 30891187877.4656 34721072261.021 37555938138.7973 44869884826.9388 55882280717.1155 60116976064.6307 60700149620.052 41249713138.7794 38402068946.5996 50264686525.7451 49355201496.8912 51638440133.1563 54323619580.7712 70744689488.541 85533796566.9168 93411756735.0525 109755093425.227 146711204310.831 115216517130.994 162436733855.738 211058032100.276 226656956637.344
Ireland 684067693.263782 786154041.54652 832689301.978842 938557266.442346 1073800534.66733 1223003604.79925 1268929036.40093 1294851820.62783 1404318219.68655 1660572265.9948 1819426245.41673 2035825802.8822 2321331731.67785 3087490250.59869 4156735787.59311 4256647424.79784 4716811805.76309 6057607333.43499 8068637250.85991 11150538803.3322 12617378054.8398 11921471767.253 10952055508.3931 10559245868.0578 11072155324.7027 11441935233.9938 13808587663.6063 16406518282.8386 18769685431.034 21034555299.5042 24844612520.251 25354218481.3808 28634116488.4486 27941298870.9867 33462301313.9846 43326442342.1717 48539766184.4758 54045914825.6925 66323783696.3104 72656880591.3062 81935820895.5224 88508271894.4072 94271764163.3729 106885830609.481 127746245270.157 141094598457.942 155021215490.108 185218696036.888 196106587074.377 167191835268.246 168849866696.053 183110553179.167 176125404471.586
Israel 321229617.526037 391311148.581666 434650140.225883 478899398.712855 557597944.276306 1169337248.21531 1181003953.94152 1467569183.24965 1894005422.32084 2324578083.57254 2770579360.42317 2961435572.15206 3617158827.31705 5201099519.03775 7332310278.87197 8304727491.63795 8600012100.31062 9028768548.34224 10350780290.696 12521647756.9347 12923936759.1107 13909418210.8495 14175218491.3314 14653639270.9404 14358309317.1296 14056071268.2342 15550058556.4815 20256609512.2635 21138511402.8693 20391358533.88 23822040244.5043 26845246875.1086 29160668312.1459 32017595222.3087 35815150756.07 35302692169.3437 37509477922.9938 37178350417.1184 35868529775.5322 40869387303.2328 46800088293.7238 43622226977.6732 42853645151.7582 44382424628.3569 52409638554.2169 57723930481.2834 62332465550.5184 73630388744.1883 83979375696.767 63401317295.2216 76976196844.076 92954723309.1112 92685510697.8915
Italy 5194804038.02597 5768145481.00503 6653172243.85064 8277784614.93831 8031770137.38168 8243744132.68937 9580519684.00021 10951837747.4583 11672839921.9542 14122467448.7355 16986679058.2404 18526841448.1898 22596281540.5046 31611424775.822 44593926763.9178 42634045077.1056 47664340544.3126 52784287908.7119 61903034451.2891 84203915171.2887 109076192629.437 102022483392.948 95945740873.2999 88237506374.2988 94125082653.7359 97629449345.9081 112142745811.144 142057066029.28 156795150252.901 172653401072.537 213995313510.019 210522553457.156 230853417124.902 185432016734.342 204889769452.45 247560204445.501 252771113063.12 255138017280.582 268566856250.697 270165778819.518 285003961673.116 286261744966.443 300722473178.995 361583972911.964 424989166402.811 463246032930.408 532588588468.038 619044314694.828 675772512542.571 512537872841.717 582568552631.579 663408333333.333 586023656466.958
Japan 4558321891.55556 5833316761.6 5641651996.44444 6863868541.15556 7922199210.66667 8308310380.08889 9538861647.64444 11697188590.9333 13213850373.6889 15463845432.8889 19617415960.9724 20914745675.9922 25494524931.7177 41903249062.6956 66656127179.4829 64449713737.9162 72435793708.5187 80077615349.9784 92116599063.0564 127466617237.596 156223571117.466 164703770687.323 151571241806.849 145827694851.008 156919115442.913 148927212553.505 148649523947.149 179078497038.373 230298458355.064 264075195417.649 291102050883.209 293616271106.73 294486484863.307 303162492057.083 340147229467.81 410558837162.82 434801354304.274 417558675900.419 348843782490.09 380450508661.467 446088961680.686 408043683436.615 394542539955.977 439654629593.69 523919292375.662 589997096662.977 649805243381.284 699452247906.653 849443202817.365 620791257036.169 768047391205.286 946896378899.887 992054191915.078
Korea, Rep. 490364607.758206 352066600.150369 453172650.059293 606790083.663235 448250537.776033 480333693.859546 766100182.506634 1030756143.5112 1506424914.39167 1879850684.38373 2119719216.89851 2519948149.21504 2597419124.94591 4360062261.49829 7286819788.85949 7598760330.57851 9460123966.94215 11837603305.7851 16438842975.2066 22060950413.2231 25511416953.3938 28350586611.4562 27250642884.4996 28796390589.7519 31359711159.0858 30319992643.8473 34036530716.4331 43681753528.5751 54881676623.785 66228516963.0358 76572284390.1888 89340287720.7336 91538205341.7024 94653219878.655 115936150351.609 154727138356.218 174745975511.219 170353625077.526 115010275145.565 144207954105.752 190456249557.898 168927179916.188 182284487926.528 213089517543.492 265147207767.262 308926200054.681 364502037097.163 424021371844.263 504693888662.039 383880322335.602 504434719374.115 601990833418.581 603465339989.196
Luxembourg 485968696.453011 529104738.976939 550136530.014877 574222742.109338 666044306.533899 692153890.564676 683946186.039868 646757316.218159 706129490.821281 809484523.131192 1028275596.4223 1193893983.24035 1359426400.69329 1861918003.91784 2414339057.71176 2563451727.89837 2623252956.18001 2920398755.70989 3618750425.18905 4462321759.95222 5002105711.20843 4213364216.10035 3885002587.54368 3794156582.21733 4108157996.84132 4408346429.81595 5858878005.10272 7431507393.10873 8404419660.46743 8888933820.0174 11176850939.0702 12231825811.9257 12933955520.8764 13049951846.9515 14700358367.2514 17611111111.1111 18705928338.7622 19178958051.4208 21489886641.4759 24366183677.818 26143357287.6359 26056017897.0917 27323734236.7777 32996275395.0339 43670261310.0892 49054618713.6248 59168704156.4792 73711742340.256 83073497637.9683 64724808048.4217 72386052631.5789 85759166666.6667 81755464129.5963
Mexico 1520943497.33618 1503120777.60176 1536527497.10396 1688128294.84493 1978567970.51704 2079751969.00928 2192167967.33415 2392911964.34284 2746231959.07796 3011215955.12939 3430407948.88294 3417959949.06843 3991119940.52768 5232143922.03499 7612159886.56999 8465679873.85155 8784409138.50832 8363203271.83178 11315762967.0901 16754179542.0551 25215695603.1639 32350082478.7066 17920283354.6255 14024762813.2941 16777515463.6572 19063167621.0249 17389311441.0515 18775670427.3301 33950974624.581 42503285801.1528 51767988093.6467 60602975350.2857 73709197680.4127 69669683977.0875 84163227352.2088 71983637024.1452 95359264659.4546 115761890658.881 130659070366.428 149426483058.445 183589199997.781 180334665998.102 184711619680.377 187872824926.744 215619540786.64 242652554354.932 278483511022.975 305973871668.764 331621582179.021 257448580308.912 326820362303.829 380230071060.385 406081650368.885
Netherlands 5769273576.55168 6268747830.82861 6668717860.19406 7423212391.77285 8729717191.94451 9027244795.97468 9731674619.45737 10258826765.8938 11264073716.4556 13285914196.7974 16242771047.6654 18386591478.6967 21145289755.5617 28768721425.1931 39145831625.5431 42324851864.7612 47444574095.6826 54589207147.3467 65207781625.5857 82440953531.8027 94763910441.1439 80625275986.9293 77261698440.208 75746274418.9638 73752747252.7473 77158970276.0085 91492174851.592 111321801566.58 124200022299.03 129505351761.405 155235386663.439 160935879302.216 173451127819.549 160980066445.183 179654921903.378 224919022783.42 227175163398.693 222819064829.456 233061541879.582 242058384828.468 248509305325.226 246357941834.452 252316958403.915 305347629796.84 359953561428.669 390100979953.241 441162855755.757 516307665355.484 591858497821.072 490361092627.142 545307894736.842 626345833333.333 613569040884.546
New Zealand 1630771747.14219 1718130409.69417 2050915167.71998 3057843328.23153 4593774131.27413 3866816128.30359 3984476812.159 4291310358.44771 4806020066.88963 6263732344.98648 6956379077.39819 7568543834.81808 7430458120.90313 7202808885.38381 7459791558.64358 7771601534.52685 7997811575.83439 9643946369.54503 10034811967.7939 11255120181.0972 11758988949.9791 10889113178.0329 11679920634.8362 12606650367.7894 15511157848.4645 17591182445.5367 18774990967.1153 17791734911.4291 15900284914.9955 17893298816.7523 17267012743.1608 17114566126.737 19819874897.7278 24643561652.62 30007853781.5126 33566092429.5775 33069753584.4156 39492629823.5294 42562288049.2958 31697675981.25 40516493201.4389 47742481070.8661 49726926505.1455
Norway 1928412857.44843 2091459664.8554 2154512918.01691 2337855859.26655 2553537264.0211 2902639177.35325 3187228449.75543 3606713981.73155 3618493868.32548 3846337834.27575 4753951476.29114 5441403648.01088 5935763941.59254 8516077560.78948 11547556726.8986 13770877575.6184 15932557500.2291 18008828778.0595 16572115292.9058 19618293477.617 23668407839.3262 22626709643.6972 22489308955.6864 20633737185.4613 20799362862.219 22739380263.3416 29094351359.7577 32011280148.423 33673776277.4283 34734303714.9685 39734971324.5044 38356908173.8111 39946254726.8485 37247853850.3827 39908042394.015 47346413688.597 50982511085.6151 52449458534.7923 54133941233.3833 50963688583.4445 49523392942.3527 49263987899.9522 53255467321.3257 61614784893.0821 73845654021.8341 84668374078.3857 95764602788.2551 119823702119.021 133926063829.787 105021205948.161 120251158940.397 139021428571.429 137872797593.468
Poland 12691363267.8094 19456396226.7033 18702271572.2395 18866413242.7727 21303644622.1364 29268282625.0113 37195949705.1296 42957469452.229 53275881912.8733 50514354278.0513 57456966868.9184 58498742030.8264 63611542071.9946 78058306848.9206 100711114270.404 114958522383.078 144053827558.421 185573065384.754 232243483313.963 169632063074.901 204088702457.141 238349767159.344 224541786920.479
Portugal 612286341.186238 771698530.929773 695615329.106465 778944373.298086 1043423697.05213 1214016242.26884 1312753746.51624 1394842053.85313 1558990663.80631 1641703442.94117 1972203574.93605 2323636625.53924 2823507824.98243 4004585446.91833 5812559706.99749 4988517080.19308 4935789376.64216 5645412017.10754 6012992726.82176 7935322859.85852 10882004104.7107 11373525984.2208 10806540422.2799 9449526966.1169 8966112995.17792 8831339964.46504 10957824049.5133 15674792410.2008 20221701997.2699 21648565853.9943 28505679141.8249 30453682435.8297 34579677605.6766 29314734694.1277 32235894075.1785 39508955817.9647 41646087860.6707 41528073184.677 45683325912.7337 47297251225.2291 46832596277.8699 46113736017.8971 47496517974.7788 55742663656.8849 67415643838.508 71121847485.4499 79892014085.3375 93130524281.5183 107114952210.056 82958784068.1926 88735789473.6842 95191527777.7778 83422087940.3446
Russian Federation 106426911165.349 92740962086.2929 66144942792.8081 222070295126.904 132666576051.34 91641644659.7275 102419312533.239 85590285293.8624 91218668971.478 66522411128.2844 51275385865.1503 62417348027.0174 74250942749.4001 84408293460.925 102759676788.74 130992710864.283 164337988333.039 207914383435.696 279983425068.802 366597057083.882 250605696858.568 322366546762.973 414003766630.899 446092693916.962
Slovak Republic 3417752774.06513 3427227908.5843 3139570219.96275 4163990882.10758 6467254071.57331 10599377898.976 9808598996.43207 10629753011.4809 14027904575.1634 17496708491.7617 17848348249.6885 20500218145.2064 19662269337.3109 20975773908.2366 24496705145.4139 27155750988.1423 35641696388.2618 43358122671.9642 49625082701.1566 61083379751.5995 73982157131.1251 84057515746.3015 62560238955.2654 71884778807.947 82985821517.9316
Slovenia 13649911683.8889 9409938543.05401 7035957536.72038 7307841577.95832 8100155475.63078 10791005090.4047 10759099930.2314 10651822267.0013 11431272843.5603 11470931555.1805 11422085938.3185 11480787524.5049 12472705908.9532 15749887492.0046 19998025586.8156 22354350822.0422 26115771162.2719 33720074129.4826 38422378274.4983 27939150301.4726 30424765651.6556 35297609118.71
South Africa 1864316848.61899 1702326026.95052 1759165018.63766 2186877974.12356 2650114985.81405 3035198787.13456 2858798857.62398 3337598666.29557 3310998587.32496 3770198403.82872 4537398097.25572 5155078904.94085 4735239531.45293 6474445258.82337 10199020475.4347 11142547107.8367 10274099549.466 9939450359.357 11625349621.891 14412914166.5697 22027807634.5316 26365472943.8966 21518732307.261 18065028962.4259 20149064076.1515 15135866038.3945 17305752138.0875 21165722163.0186 25917812673.9505 26713671161.111 21016335058.0475 21011728015.0943 22581585357.0152 23232865150.419 26964921486.2949 33385762153.3546 33339928807.6742 34878327481.4569 32916541026.0959 30286844447.1239 33107013963.5058 30897365468.511 32316116758.332 42967055858.5386 58544427617.8781 68805851351.702 84705727726.7548 97906070161.0208 106368871115.537 80048865147.7926 100119079012.949 120140769249.49 120314832483.09
Spain 833136311.915058 1189957607.49029 1633079903.89791 2056286550.59836 2429704294.8789 3254542781.7677 3893500155.76512 3760819358.16915 3966047696.32078 4731368827.75013 5314755599.59769 5686625959.77523 7750946466.80665 11010852178.2881 17051560206.4308 18162537719.5329 19651128376.7129 19957604324.6777 21057162804.8022 28719279104.0429 38067100104.9647 36676262643.3894 36288241076.1181 33499701532.6247 32984113074.5378 34244805126.6033 40816380970.2876 56129004895.1605 69144113349.4514 81624045712.1284 101042531559.541 107770735186.997 118240110555.918 95673287697.6858 107185646066.586 133564184681.078 143718639169.841 145673863636.364 161548056576.456 176232686980.609 186756955960.936 189112304250.559 202100508187.465 253590293453.725 312653269014.67 349809729891.061 403692696775.1 484670931432.529 514881898414.326 375552724691.356 406194736842.105 463481944444.444 422141938801.748
Sweden 3478162823.30401 3502543049.21583 3746139447.76182 4078651382.15425 4627511693.05679 5243778277.10376 5550485984.66523 5765191831.34116 6290293456.90543 7291708940.09598 8454534910.69357 8671647905.73363 9990760960.86007 13173585510.4985 19587331621.3903 21143249361.7841 23583415597.2359 24700107104.6055 25561358858.0281 34872524550.3954 40537639493.0963 35953706995.2996 34706013433.9286 32584419141.5268 33068497787.6641 35518427689.7686 41497557414.7903 51974954261.5608 58673619271.4454 63768943213.0171 72569270798.1348 68084993799.0905 70081046739.2424 58645836009.9699 68810393986.5215 83504408899.107 88319415448.8518 87548887346.2652 92623932376.5079 94719694035.6313 99320905459.3875 90022364000.7358 94415688449.333 115480998726.241 136780928820.543 150482196788.745 171645173313.455 205398467472.632 227411964618.956 168309811309.908 200427600554.785 237474730354.391 223816826568.266
Switzerland 2546890123.0599 3068472924.55224 3427708776.84942 3694832986.2286 4097821745.97422 4146180481.44376 4411016178.07445 4635551289.31248 5060440504.88573 5896400749.46832 7462904307.35555 8499588387.80566 10066496817.199 13748725617.1403 17053202006.6953 16195129956.0217 17969510844.6943 21588302571.2094 28926394067.9849 35694482330.9483 42746628002.029 37722939079.5235 35405086574.3979 35926498146.3484 36194290901.3917 37546770107.4437 50240926803.0463 61941042776.2876 69096076379.4164 70948879384.4367 85278476855.7443 81944882286.6109 82453594295.975 77290198393.3405 85938880051.1808 100704560936.998 99106059290.4531 94120687592.5033 99286338308.0425 99722830517.9071 103433411392.705 105127858728.372 106274871076.607 122010678185.936 143211921614.797 157508346224.642 173424552676.578 200229960269.75 226354973201.673 200330851505.321 225570408625.962 268704461024.719 264237241234.937
Turkey 508631307.180588 549999986.831276 714999982.880658 725999982.617284 615999985.251029 648999984.460906 802999980.773662 780999981.300411 890999978.666667 924777756.444444 1085652190.6087 1340551027.68653 1743180166.78445 2338586595.053 4015868452.35873 5011286680.51516 5469507472.49735 6281357751.36096 4748785197.92439 5258679855.06967 8204476645.0459 9167696154.36211 9692635428.34645 10212807328.617 11802064179.0771 12751984316.0563 12193711077.1138 15479659810.7727 15947270362.4284 19050893631.4619 26485716695.2895 25125532741.1058 27595234984.1148 34899598547.1299 26639520270.2703 41271567685.5895 50498579852.5798 57688103357.472 54343011123.8972 48167046322.8271 61561834612.9239 45699317069.1906 54838097133.758 72836671996.8019 102691164503.683 122442651086.633 146427818690.935 177863291119.81 206982593161.736 150085208662.699 195652620691.922 252944438151.041 249044954146.755
United Kingdom 15617572732.5516 15522854822.3374 15815127026.1986 16851607900.1447 19076116870.7803 19509114055.7592 20239775211.8208 21697473493.319 22507195654.7948 23743551742.9815 26582458182.6626 29501730745.5782 34187772328.7762 46257873234.4255 63272257175.2676 63538907256.3496 65705713865.6785 73883228973.2913 86933756128.2136 114966293056.101 133810098662.865 121384901518.225 118477357545.13 117705257503.865 123468984961.215 127043853066.467 148343380213.317 182729245982.107 222415011566.428 234120121316.171 264287997159.091 251894179894.18 267599157599.158 256564187162.568 285554025099.48 328950607543.001 356634945397.816 382863457760.314 397313680026.499 414233942727.714 435515206536.541 433394270908.306 463541666666.667 520876734693.878 620279028891.574 682589754871.836 777910051206.376 834878704689.338 849924443807.15 662924761535.334 738647692307.692 832490322580.645 834025276461.295
United States 22818985984 22667126784 24942039040 26111950848 28079147008 31499999232 37099999232 39900000256 46599999488 50500001792 55800000000 62300000000 74200000000 91200000000 127500000000 122700000000 151100000000 182400000000 212200000000 252700000000 293800000000 317800000000 303200000000 328600000000 405100000000 417200000000 452900000000 508700000000 554000000000 591000000000 629700000000 623500000000 667800000000 720000000000 813400000000 902600000000 964000000000 1055800000000 1115700000000 1250600000000 1474400000000 1397800000000 1429700000000 1544300000000 1797900000000 2026100000000 2240900000000 2375500000000 2556400000000 1976000000000 2362000000000 2669900000000 2743100000000
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Import/Export</title>
<link rel="stylesheet" href="style.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" charset="utf-8"></script>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<div id="wait">Loading data…</div>
<!--<select name="countries" id="countries"></select>-->
<div id="container"></div>
<p><span class="imports">Imports</span> and <span class="exports">exports</span> of goods and services in current US$</p>
<script src="script.js"></script>
</body>
</html>
var impexp = {};
impexp.dataManager = function module() {
var exports = {},
// Custom events:
dispatch = d3.dispatch('dataReady', 'dataLoading'),
data;
exports.loadCsvData = function(_file, _cleaningFunc) {
var loadCsv = d3.csv(_file);
loadCsv.on('progress', function() {
dispatch.dataLoading(d3.event.loaded); });
loadCsv.get(function(_error, _response) {
// Apply the cleaning function supplied in the _cleaningFunc parameter.
_response.forEach(function(d) {
_cleaningFunc(d);
});
// Assign cleaned response to data.
data = _response;
dispatch.dataReady(_response);
});
};
exports.getCleanedData = function() {
return data;
};
d3.rebind(exports, dispatch, 'on');
return exports;
};
/**
* For combining our sets of import and export data into one data structure.
* var combiner = impexp.dataCombiner();
* var data = combiner.combine(imports_data, exports_data);
*/
impexp.dataCombiner = function module() {
var exports = {};
/**
* Both imports_data and exports_data are like:
* [
* {1999: '15', 2000: '25', 2001: '30', 'Country': 'France'}
* {1999: '16', 2000: '18', 2001: '22', 'Country': 'UK'}
* ]
* and it returns this:
* {
* 'France': [
* {
* year: 1999,
* imports: 15,
* exports: 33
* }...
* ],
* 'UK': [
* ...
* ]
* }
*/
exports.combine = function(imports_data, exports_data) {
// The basis for what we'll return:
combined_data = keyByCountryWithArrays('imports', imports_data);
// So we can access its data more easily:
exports_by_country = keyByCountry(exports_data);
// Add the export data to the transformed import data:
d3.keys(combined_data).forEach(function(country) {
if (country in exports_by_country) {
combined_data[country].forEach(function(year_data, n) {
var year = year_data['year'];
if (year in exports_by_country[country]) {
combined_data[country][n]['exports'] = exports_by_country[country][year];
};
});
};
});
return combined_data;
};
/**
* `kind` is one of 'imports' or 'exports'.
* `rows` is an array or objects.
*
* Changes from:
* [
* {1999: '15', 2000: '25', 2001: '30', 'Country': 'France'}
* {1999: '16', 2000: '18', 2001: '22', 'Country': 'UK'}
* ]
*
* to (if `kind` is 'imports'):
* {
* 'France': [
* {'year': 1999, 'imports': 15},
* {'year': 2000, 'imports': 25}, ...
* ],
* 'UK': [ ...
* }
*/
keyByCountryWithArrays = function(kind, rows) {
var countries = {};
rows.forEach(function(row) {
var years = [];
// k will be either a year or 'Country':
d3.keys(row).forEach(function(k) {
if (k !== 'Country') {
var year_data = {year: new Date(+k, 0, 1)};
// Make missing data null, ensure everything else is a number.
year_data[kind] = row[k] === '' ? null : +row[k];
// year_data will be like {'year': DateObj, 'imports': 15}
years.push(year_data);
};
});
countries[row['Country']] = years;
});
return countries;
};
/**
* Takes this:
* [
* {1999: '15', 2000: '25', 2001: '30', 'Country': 'France'}
* {1999: '16', 2000: '18', 2001: '22', 'Country': 'UK'}
* ]
* and returns this:
* {
* 'France': {1999: 15, 2000: 25, 2001: 30},
* 'UK': {1999: 16, 2000: 18, 2001: 22}
* }
*/
keyByCountry = function(rows) {
var countries = {};
rows.forEach(function(row) {
// Get the country name and remove from the row's data.
var country = row['Country'];
delete row['Country'];
// Make sure all years and values are numeric:
var year_data = {};
d3.keys(row).forEach(function(k) {
// Make a Date object for 1st Jan for the corresponding year.
var year = new Date(+k, 0, 1);
// Make missing data null, ensure everything else is a number.
year_data[year] = row[k] === '' ? null : +row[k];
});
countries[country] = year_data;
})
return countries;
};
return exports;
};
impexp.chart = function module() {
var margin = {top: 20, right: 20, bottom: 30, left: 50},
width = 400,
height = 300,
inner_width = width - margin.left - margin.right,
inner_height = height - margin.top - margin.bottom,
xValue = function(d) { return d[0]; },
yValue = function(d) { return d[1]; },
xScale = d3.time.scale(),
yScale = d3.scale.linear(),
xAxis = d3.svg.axis().scale(xScale).orient('bottom')
.tickFormat(d3.time.format('%Y'))
.ticks(d3.time.years, 5),
yAxis = d3.svg.axis().scale(yScale).orient('left')
.tickFormat(function(d){
return d3.format(',')(d / 1000000000);
}),
// defined() ensures we only draw the lines where there is data.
imports_line = d3.svg.line().x(X).y(YImports)
.defined(function(d){ return d.imports !== null; }),
exports_line = d3.svg.line().x(X).y(YExports)
.defined(function(d){ return d.exports !== null; }),
// defined() ensures we draw the area only when both lines have data.
area = d3.svg.area().x(X).y1(YImports)
.defined(function(d){
return d.imports !== null && d.exports !== null; });
var dispatch = d3.dispatch('customHover');
function exports(_selection) {
_selection.each(function(data) {
inner_width = width - margin.left - margin.right;
inner_height = height - margin.top - margin.bottom;
// Update scales.
// Use min/max of the years from all countries we're displaying.
xScale.domain([
d3.min(data, function(country){
return d3.min(country.values, function(v) { return v.year; })
}),
d3.max(data, function(country){
return d3.max(country.values, function(v) { return v.year; })
})
]).range([0, inner_width]);
// Use maximum value of all imports or exports from all countries.
yScale.domain([
0,
d3.max(data, function(country){
return d3.max(country.values, function(v) {
return Math.max(v.imports, v.exports);
})
}),
]).range([inner_height, 0]);
// Select svg element if it exists.
var svg = d3.select(this)
.selectAll('svg')
.data([data]);
// Or create skeletal chart, with no data applied.
var gEnter = svg.enter().append('svg').append('g');
//gEnter.append('clipPath')
//.attr('id', 'clip-surplus')
//.append('path')
//.attr('class', 'clip surplus');
//gEnter.append('clipPath')
//.attr('id', 'clip-deficit')
//.append('path')
//.attr('class', 'clip deficit');
//gEnter.append('path')
//.attr('class', 'area surplus')
//.attr('clip-path', 'url("#clip-surplus")');
//gEnter.append('path')
//.attr('class', 'area deficit')
//.attr('clip-path', 'url("#clip-deficit")');
gEnter.append('path').attr('class', 'line imports');
gEnter.append('path').attr('class', 'line exports');
gEnter.append('g').attr('class', 'x axis');
gEnter.append('g').attr('class', 'y axis');
// Update outer dimensions.
svg.transition()
.attr({ width: width, height: height });
// Update inner dimensions.
var g = svg.select('g')
.attr('transform',
'translate(' + margin.left + ',' + margin.right + ')');
// Update lines/areas.
//g.select('.clip.surplus').attr('d', area.y0(0));
//g.select('.clip.deficit').attr('d', area.y0(inner_height));
//g.select('.area.surplus').attr('d', area.y0(
//function(d) { return yScale(d['exports']); }));
//g.select('.area.deficit').attr('d', area);
// Hello - HERE IS WHERE IT'S CURRENTLY FAILING.
// The d[0].values is wrong, but it does at least draw the first pair of lines.
// Each element of array d is like:
// {name: 'United Kingdom', values: [{imports: 3, exports: 4, year: 1960}, {}, {}...]}
g.select('.line.imports').attr('d', function(d){
return imports_line(d[0].values); });
g.select('.line.exports').attr('d', function(d){
return exports_line(d[0].values); });
// Update axes.
g.select('.x.axis')
.attr('transform', 'translate(0,' + yScale.range()[0] + ')')
.call(xAxis);
g.select('.y.axis')
.call(yAxis);
});
};
// The x-accessor for the path generator; xScale ∘ xValue.
function X(d) {
return xScale(d.year);
}
// The x-accessor for the path generator; yScale ∘ yValue.
function YImports(d) {
return yScale(d.imports);
}
function YExports(d) {
return yScale(d.exports);
}
exports.margin = function(_) {
if (!arguments.length) return margin;
margin = _;
return this;
};
exports.width = function(_) {
if (!arguments.length) return width;
width = _;
return this;
};
exports.height = function(_) {
if (!arguments.length) return height;
height = _;
return this;
};
exports.x = function(_) {
if (!arguments.length) return xValue;
xValue = _;
return chart;
};
exports.y = function(_) {
if (!arguments.length) return yValue;
yValue = _;
return chart;
};
d3.rebind(exports, dispatch, "on");
return exports;
};
impexp.controller = function module() {
var exports = {},
chart,
data,
container,
default_country = 'United Kingdom',
importsDataManager = impexp.dataManager(),
exportsDataManager = impexp.dataManager();
/**
* Call this to start everything going.
*/
exports.init = function() {
// Could be used to clean the data, but we don't need to.
var csvCleaner = function(d){};
// Load both files.
// After this you could do importsDataManager.getCleanedData() to see
// what was loaded.
importsDataManager.loadCsvData('imports.csv', csvCleaner);
exportsDataManager.loadCsvData('exports.csv', csvCleaner);
// Once the data has loaded, each manager will send 'dataReady' events.
// So, once both have happened, we want to draw the chart:
var loaded = 0;
importsDataManager.on('dataReady', function() {
loaded++;
if (loaded == 2) {
draw_chart();
};
});
exportsDataManager.on('dataReady', function() {
loaded++;
if (loaded == 2) {
draw_chart();
};
});
};
/**
* Called once all the CSV data has been loaded.
*/
var draw_chart = function() {
$('#wait').hide();
var combiner = impexp.dataCombiner();
data = combiner.combine(importsDataManager.getCleanedData(),
exportsDataManager.getCleanedData());
init_form();
chart = impexp.chart()
.width(800).height(400)
.margin({top: 50, right: 50, bottom: 50, left: 50});
container = d3.select('#container')
.datum([{
name: 'United Kingdom',
values: data['United Kingdom']
},
{
name: 'United States',
values: data['United States']
}])
.call(chart);
};
var init_form = function() {
// Add all the countries we have data for to the select field.
d3.keys(data).forEach(function(country) {
var option = $('<option/>').attr('value', country).text(country);
if (country == default_country) {
option.attr('selected', 'selected');
};
$('#countries').append(option);
});
// When a new country is selected, change the chart.
$('#countries').on('change', on_country_select_change);
};
var on_country_select_change = function(ev) {
change_country(ev.target.selectedOptions[0].value);
};
/**
* `country` is the name of the country, eg 'United States'.
* Should match a key in the combined data structure.
*/
var change_country = function(country) {
update_chart(data[country]);
};
var update_chart = function(country_data) {
container.datum(country_data)
.transition()
.ease('linear')
.call(chart);
};
return exports;
}
// Let's go!
var controller = impexp.controller();
controller.init();
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.axis path,
.axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
.area.surplus {
fill: #cfc;
}
.area.deficit {
fill: #fcc;
}
.line {
fill: none;
stroke-width: 1.5px;
}
.line.imports {
stroke: #900;
}
.line.exports {
stroke: #090;
}
.imports {
color: #900;
}
.exports {
color: #090;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment