Skip to content

Instantly share code, notes, and snippets.

@twedl
Last active April 25, 2016 01:37
Show Gist options
  • Save twedl/38c2d14852713bd08804 to your computer and use it in GitHub Desktop.
Save twedl/38c2d14852713bd08804 to your computer and use it in GitHub Desktop.
Canadian Trade Map (Choropleth)

Choropleth Map

Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
dger oger d o value x
101 101 1 1 6.755099 3.377549
102 101 2 1 .9184319 3.377549
111 101 3 1 .1913286 3.377549
121 101 4 1 .875154 3.377549
122 101 5 1 1.650159 3.377549
131 101 6 1 1.556971 3.377549
132 101 7 1 .6325936 3.377549
241 101 8 1 .8548082 3.377549
242 101 9 1 .1406847 3.377549
243 101 10 1 12.30843 3.377549
244 101 11 1 17.8286 3.377549
245 101 12 1 9.33896 3.377549
351 101 13 1 .3235108 3.377549
352 101 14 1 .4799995 3.377549
353 101 15 1 1.860957 3.377549
354 101 16 1 11.26481 3.377549
355 101 17 1 3.719002 3.377549
461 101 18 1 2.234607 3.377549
462 101 19 1 .9162492 3.377549
463 101 20 1 .4110537 3.377549
471 101 21 1 2.449453 3.377549
472 101 22 1 .8577356 3.377549
473 101 23 1 .5917357 3.377549
481 101 24 1 5.657924 3.377549
482 101 25 1 2.537511 3.377549
483 101 26 1 2.264626 3.377549
484 101 27 1 1.231419 3.377549
591 101 28 1 1.206815 3.377549
592 101 29 1 3.529199 3.377549
593 101 30 1 10.1162 3.377549
101 102 1 2 .7575766 2.530518
102 102 2 2 5.061035 2.530518
111 102 3 2 .1129688 2.530518
121 102 4 2 .4276072 2.530518
122 102 5 2 .963569 2.530518
131 102 6 2 .766647 2.530518
132 102 7 2 .3279542 2.530518
241 102 8 2 .4080774 2.530518
242 102 9 2 .0878008 2.530518
243 102 10 2 6.889891 2.530518
244 102 11 2 10.055 2.530518
245 102 12 2 1.480555 2.530518
351 102 13 2 .2354518 2.530518
352 102 14 2 .3187547 2.530518
353 102 15 2 1.326301 2.530518
354 102 16 2 7.974119 2.530518
355 102 17 2 2.213666 2.530518
461 102 18 2 1.204972 2.530518
462 102 19 2 .917269 2.530518
463 102 20 2 .4608912 2.530518
471 102 21 2 1.165266 2.530518
472 102 22 2 1.217824 2.530518
473 102 23 2 .6298804 2.530518
481 102 24 2 .8519041 2.530518
482 102 25 2 6.499557 2.530518
483 102 26 2 8.909957 2.530518
484 102 27 2 2.023512 2.530518
591 102 28 2 .4553511 2.530518
592 102 29 2 5.382434 2.530518
593 102 30 2 9.320254 2.530518
101 111 1 3 .1503081 .9062194
102 111 2 3 .0930784 .9062194
111 111 3 3 1.812439 .9062194
121 111 4 3 1.692256 .9062194
122 111 5 3 1.184414 .9062194
131 111 6 3 1.438497 .9062194
132 111 7 3 .4404582 .9062194
241 111 8 3 .2006608 .9062194
242 111 9 3 .009739 .9062194
243 111 10 3 5.414035 .9062194
244 111 11 3 6.911134 .9062194
245 111 12 3 .449154 .9062194
351 111 13 3 .0407283 .9062194
352 111 14 3 .1101484 .9062194
353 111 15 3 .5651155 .9062194
354 111 16 3 2.588384 .9062194
355 111 17 3 .9924783 .9062194
461 111 18 3 .1654219 .9062194
462 111 19 3 .1445728 .9062194
463 111 20 3 .0834777 .9062194
471 111 21 3 .1392545 .9062194
472 111 22 3 .0893323 .9062194
473 111 23 3 .0883863 .9062194
481 111 24 3 .2465508 .9062194
482 111 25 3 .4760736 .9062194
483 111 26 3 .2240966 .9062194
484 111 27 3 .1705758 .9062194
591 111 28 3 .2012276 .9062194
592 111 29 3 .4999156 .9062194
593 111 30 3 1.470888 .9062194
101 121 1 4 .9519756 3.573834
102 121 2 4 .4462608 3.573834
111 121 3 4 1.767233 3.573834
121 121 4 4 7.147668 3.573834
122 121 5 4 5.523361 3.573834
131 121 6 4 4.873829 3.573834
132 121 7 4 1.828804 3.573834
241 121 8 4 .8669413 3.573834
242 121 9 4 .052732 3.573834
243 121 10 4 21.29044 3.573834
244 121 11 4 25.39795 3.573834
245 121 12 4 2.024198 3.573834
351 121 13 4 .2288505 3.573834
352 121 14 4 .4678867 3.573834
353 121 15 4 2.211496 3.573834
354 121 16 4 13.92808 3.573834
355 121 17 4 5.308393 3.573834
461 121 18 4 .5457894 3.573834
462 121 19 4 .514654 3.573834
463 121 20 4 .3040584 3.573834
471 121 21 4 .5970657 3.573834
472 121 22 4 .5446651 3.573834
473 121 23 4 .416812 3.573834
481 121 24 4 1.332499 3.573834
482 121 25 4 1.992964 3.573834
483 121 26 4 .955837 3.573834
484 121 27 4 .7818258 3.573834
591 121 28 4 .7792096 3.573834
592 121 29 4 2.133682 3.573834
593 121 30 4 5.573694 3.573834
101 122 1 5 1.691983 10.42311
102 122 2 5 .809492 10.42311
111 122 3 5 1.055566 10.42311
121 122 4 5 6.005443 10.42311
122 122 5 5 20.84621 10.42311
131 122 6 5 11.02053 10.42311
132 122 7 5 10.65129 10.42311
241 122 8 5 2.430527 10.42311
242 122 9 5 .0854468 10.42311
243 122 10 5 56.73632 10.42311
244 122 11 5 98.27987 10.42311
245 122 12 5 3.765926 10.42311
351 122 13 5 .6205082 10.42311
352 122 14 5 1.194772 10.42311
353 122 15 5 6.790426 10.42311
354 122 16 5 48.47726 10.42311
355 122 17 5 13.85738 10.42311
461 122 18 5 1.217295 10.42311
462 122 19 5 1.849501 10.42311
463 122 20 5 .8969474 10.42311
471 122 21 5 1.222898 10.42311
472 122 22 5 .958194 10.42311
473 122 23 5 1.145618 10.42311
481 122 24 5 2.196095 10.42311
482 122 25 5 5.010551 10.42311
483 122 26 5 2.299997 10.42311
484 122 27 5 1.893026 10.42311
591 122 28 5 1.640375 10.42311
592 122 29 5 5.301245 10.42311
593 122 30 5 13.16559 10.42311
101 131 1 6 1.845781 9.423959
102 131 2 6 .7151924 9.423959
111 131 3 6 1.781626 9.423959
121 131 4 6 5.378791 9.423959
122 131 5 6 12.37093 9.423959
131 131 6 6 18.84792 9.423959
132 131 7 6 6.727933 9.423959
241 131 8 6 2.406441 9.423959
242 131 9 6 .1020517 9.423959
243 131 10 6 77.27933 9.423959
244 131 11 6 74.29166 9.423959
245 131 12 6 3.960959 9.423959
351 131 13 6 .4512419 9.423959
352 131 14 6 1.222578 9.423959
353 131 15 6 7.203204 9.423959
354 131 16 6 36.01293 9.423959
355 131 17 6 11.61778 9.423959
461 131 18 6 1.40488 9.423959
462 131 19 6 1.285042 9.423959
463 131 20 6 .7819102 9.423959
471 131 21 6 1.095718 9.423959
472 131 22 6 1.207847 9.423959
473 131 23 6 .8508819 9.423959
481 131 24 6 2.151278 9.423959
482 131 25 6 4.322976 9.423959
483 131 26 6 1.798205 9.423959
484 131 27 6 1.24411 9.423959
591 131 28 6 1.644162 9.423959
592 131 29 6 4.236586 9.423959
593 131 30 6 7.902797 9.423959
101 132 1 7 .5944058 4.418261
102 132 2 7 .3255462 4.418261
111 132 3 7 .4279907 4.418261
121 132 4 7 1.610022 4.418261
122 132 5 7 10.67458 4.418261
131 132 6 7 5.43186 4.418261
132 132 7 7 8.836521 4.418261
241 132 8 7 1.038492 4.418261
242 132 9 7 .0378416 4.418261
243 132 10 7 30.41353 4.418261
244 132 11 7 35.83868 4.418261
245 132 12 7 1.410187 4.418261
351 132 13 7 .2026625 4.418261
352 132 14 7 .442605 4.418261
353 132 15 7 2.580091 4.418261
354 132 16 7 17.72128 4.418261
355 132 17 7 6.323104 4.418261
461 132 18 7 .5507026 4.418261
462 132 19 7 .460527 4.418261
463 132 20 7 .2677757 4.418261
471 132 21 7 .4210112 4.418261
472 132 22 7 .3637255 4.418261
473 132 23 7 .3422357 4.418261
481 132 24 7 .8701473 4.418261
482 132 25 7 1.781007 4.418261
483 132 26 7 .7635267 4.418261
484 132 27 7 .4968948 4.418261
591 132 28 7 .6888402 4.418261
592 132 29 7 1.851058 4.418261
593 132 30 7 4.199234 4.418261
101 241 1 8 .6711654 9.996342
102 241 2 8 .3942817 9.996342
111 241 3 8 .2488383 9.996342
121 241 4 8 1.126097 9.996342
122 241 5 8 2.921079 9.996342
131 241 6 8 2.428635 9.996342
132 241 7 8 1.005233 9.996342
241 241 8 8 19.99268 9.996342
242 241 9 8 .0331899 9.996342
243 241 10 8 45.00341 9.996342
244 241 11 8 126.5924 9.996342
245 241 12 8 1.530324 9.996342
351 241 13 8 .4126011 9.996342
352 241 14 8 2.288568 9.996342
353 241 15 8 8.31549 9.996342
354 241 16 8 59.19392 9.996342
355 241 17 8 20.75733 9.996342
461 241 18 8 .8030959 9.996342
462 241 19 8 1.141092 9.996342
463 241 20 8 .631912 9.996342
471 241 21 8 .5642848 9.996342
472 241 22 8 .625756 9.996342
473 241 23 8 .5554993 9.996342
481 241 24 8 .9121022 9.996342
482 241 25 8 2.057271 9.996342
483 241 26 8 .9769157 9.996342
484 241 27 8 .9621992 9.996342
591 241 28 8 1.009106 9.996342
592 241 29 8 1.933649 9.996342
593 241 30 8 4.798418 9.996342
101 242 1 9 .1417255 .2128789
102 242 2 9 .0718803 .2128789
111 242 3 9 .0124255 .2128789
121 242 4 9 .0443922 .2128789
122 242 5 9 .1054098 .2128789
131 242 6 9 .0860841 .2128789
132 242 7 9 .0384583 .2128789
241 242 8 9 .0416245 .2128789
242 242 9 9 .4257579 .2128789
243 242 10 9 .8095168 .2128789
244 242 11 9 .9217952 .2128789
245 242 12 9 .2131192 .2128789
351 242 13 9 .0159542 .2128789
352 242 14 9 .0205522 .2128789
353 242 15 9 .1213376 .2128789
354 242 16 9 .7812055 .2128789
355 242 17 9 .1906389 .2128789
461 242 18 9 .1006621 .2128789
462 242 19 9 .0517568 .2128789
463 242 20 9 .0354751 .2128789
471 242 21 9 .102404 .2128789
472 242 22 9 .0579275 .2128789
473 242 23 9 .0508881 .2128789
481 242 24 9 .1204645 .2128789
482 242 25 9 .3294725 .2128789
483 242 26 9 .2175756 .2128789
484 242 27 9 .114427 .2128789
591 242 28 9 .0495931 .2128789
592 242 29 9 .3673041 .2128789
593 242 30 9 .9594192 .2128789
101 243 1 10 17.79018 81.41227
102 243 2 10 7.270721 81.41227
111 243 3 10 5.033226 81.41227
121 243 4 10 21.7587 81.41227
122 243 5 10 82.5201 81.41227
131 243 6 10 80.54327 81.41227
132 243 7 10 33.68211 81.41227
241 243 8 10 42.42306 81.41227
242 243 9 10 .7913002 81.41227
243 243 10 10 162.8245 81.41227
244 243 11 10 945.9609 81.41227
245 243 12 10 39.90512 81.41227
351 243 13 10 4.997864 81.41227
352 243 14 10 17.67362 81.41227
353 243 15 10 85.94684 81.41227
354 243 16 10 490.2909 81.41227
355 243 17 10 172.0134 81.41227
461 243 18 10 13.53344 81.41227
462 243 19 10 14.74495 81.41227
463 243 20 10 7.349112 81.41227
471 243 21 10 10.95336 81.41227
472 243 22 10 9.763627 81.41227
473 243 23 10 9.891609 81.41227
481 243 24 10 20.96619 81.41227
482 243 25 10 31.39489 81.41227
483 243 26 10 16.05449 81.41227
484 243 27 10 15.02452 81.41227
591 243 28 10 22.49633 81.41227
592 243 29 10 31.45923 81.41227
593 243 30 10 108.7228 81.41227
101 244 1 11 16.15377 133.5617
102 244 2 11 8.857075 133.5617
111 244 3 11 6.126174 133.5617
121 244 4 11 24.60857 133.5617
122 244 5 11 71.8672 133.5617
131 244 6 11 69.99261 133.5617
132 244 7 11 33.56312 133.5617
241 244 8 11 116.6014 133.5617
242 244 9 11 .962057 133.5617
243 244 10 11 963.4526 133.5617
244 244 11 11 267.1234 133.5617
245 244 12 11 33.57552 133.5617
351 244 13 11 7.534922 133.5617
352 244 14 11 34.58881 133.5617
353 244 15 11 184.95 133.5617
354 244 16 11 1284.877 133.5617
355 244 17 11 612.5109 133.5617
461 244 18 11 16.47059 133.5617
462 244 19 11 24.47541 133.5617
463 244 20 11 13.40433 133.5617
471 244 21 11 12.73656 133.5617
472 244 22 11 12.71725 133.5617
473 244 23 11 10.07681 133.5617
481 244 24 11 21.57661 133.5617
482 244 25 11 50.08873 133.5617
483 244 26 11 22.73828 133.5617
484 244 27 11 19.30657 133.5617
591 244 28 11 25.00817 133.5617
592 244 29 11 48.74141 133.5617
593 244 30 11 125.7267 133.5617
101 245 1 12 8.183179 10.00411
102 245 2 12 1.437302 10.00411
111 245 3 12 .4665961 10.00411
121 245 4 12 1.934394 10.00411
122 245 5 12 3.980957 10.00411
131 245 6 12 3.529177 10.00411
132 245 7 12 1.405562 10.00411
241 245 8 12 1.795863 10.00411
242 245 9 12 .1911757 10.00411
243 245 10 12 37.41062 10.00411
244 245 11 12 35.90169 10.00411
245 245 12 12 20.00821 10.00411
351 245 13 12 .6624583 10.00411
352 245 14 12 1.016911 10.00411
353 245 15 12 4.871327 10.00411
354 245 16 12 25.11363 10.00411
355 245 17 12 6.064739 10.00411
461 245 18 12 3.995118 10.00411
462 245 19 12 1.684648 10.00411
463 245 20 12 .973592 10.00411
471 245 21 12 2.758972 10.00411
472 245 22 12 1.291728 10.00411
473 245 23 12 1.093612 10.00411
481 245 24 12 106.4077 10.00411
482 245 25 12 5.952416 10.00411
483 245 26 12 3.338644 10.00411
484 245 27 12 2.095529 10.00411
591 245 28 12 2.486703 10.00411
592 245 29 12 5.960051 10.00411
593 245 30 12 18.11478 10.00411
101 351 1 13 .2683096 1.202646
102 351 2 13 .1826936 1.202646
111 351 3 13 .0492548 1.202646
121 351 4 13 .2146294 1.202646
122 351 5 13 .5208763 1.202646
131 351 6 13 .5053872 1.202646
132 351 7 13 .1705489 1.202646
241 351 8 13 .4132025 1.202646
242 351 9 13 .0175849 1.202646
243 351 10 13 5.938456 1.202646
244 351 11 13 8.23256 1.202646
245 351 12 13 .6926816 1.202646
351 351 13 13 2.405293 1.202646
352 351 14 13 .3491465 1.202646
353 351 15 13 1.171614 1.202646
354 351 16 13 6.161984 1.202646
355 351 17 13 1.945895 1.202646
461 351 18 13 .4395681 1.202646
462 351 19 13 .6959411 1.202646
463 351 20 13 .3782994 1.202646
471 351 21 13 .2898907 1.202646
472 351 22 13 .3307862 1.202646
473 351 23 13 .2802103 1.202646
481 351 24 13 .369106 1.202646
482 351 25 13 1.112621 1.202646
483 351 26 13 .4948697 1.202646
484 351 27 13 .3777575 1.202646
591 351 28 13 .3825159 1.202646
592 351 29 13 .8294702 1.202646
593 351 30 13 2.060888 1.202646
101 352 1 14 .4598269 3.542325
102 352 2 14 .2883061 3.542325
111 352 3 14 .0996919 3.542325
121 352 4 14 .5138136 3.542325
122 352 5 14 1.352088 3.542325
131 352 6 14 1.165804 3.542325
132 352 7 14 .4578993 3.542325
241 352 8 14 2.273637 3.542325
242 352 9 14 .0279506 3.542325
243 352 10 14 19.60182 3.542325
244 352 11 14 28.17949 3.542325
245 352 12 14 1.056097 3.542325
351 352 13 14 .4334838 3.542325
352 352 14 14 7.08465 3.542325
353 352 15 14 5.615449 3.542325
354 352 16 14 23.63927 3.542325
355 352 17 14 6.302062 3.542325
461 352 18 14 .5926382 3.542325
462 352 19 14 .9119102 3.542325
463 352 20 14 .5942709 3.542325
471 352 21 14 .3445869 3.542325
472 352 22 14 .4321641 3.542325
473 352 23 14 .4572918 3.542325
481 352 24 14 .5352532 3.542325
482 352 25 14 1.518714 3.542325
483 352 26 14 .6196489 3.542325
484 352 27 14 .6078673 3.542325
591 352 28 14 .6035271 3.542325
592 352 29 14 1.183771 3.542325
593 352 30 14 2.859097 3.542325
101 353 1 15 2.619635 43.27529
102 353 2 15 1.408332 43.27529
111 353 3 15 .6642198 43.27529
121 353 4 15 2.465571 43.27529
122 353 5 15 7.923324 43.27529
131 353 6 15 7.255406 43.27529
132 353 7 15 2.469556 43.27529
241 353 8 15 7.845848 43.27529
242 353 9 15 .1529994 43.27529
243 353 10 15 72.44123 43.27529
244 353 11 15 196.9111 43.27529
245 353 12 15 4.777399 43.27529
351 353 13 15 1.233913 43.27529
352 353 14 15 5.031914 43.27529
353 353 15 15 86.55058 43.27529
354 353 16 15 803.1068 43.27529
355 353 17 15 80.61526 43.27529
461 353 18 15 2.758193 43.27529
462 353 19 15 4.367545 43.27529
463 353 20 15 2.819548 43.27529
471 353 21 15 1.710434 43.27529
472 353 22 15 2.733707 43.27529
473 353 23 15 2.134925 43.27529
481 353 24 15 2.865755 43.27529
482 353 25 15 7.566915 43.27529
483 353 26 15 3.114 43.27529
484 353 27 15 2.907027 43.27529
591 353 28 15 2.199523 43.27529
592 353 29 15 8.616741 43.27529
593 353 30 15 14.26647 43.27529
101 354 1 16 11.5818 118.1879
102 354 2 16 7.438964 118.1879
111 354 3 16 3.264623 118.1879
121 354 4 16 16.1138 118.1879
122 354 5 16 53.40347 118.1879
131 354 6 16 35.10606 118.1879
132 354 7 16 15.82984 118.1879
241 354 8 16 43.72799 118.1879
242 354 9 16 .8560012 118.1879
243 354 10 16 379.8112 118.1879
244 354 11 16 884.6879 118.1879
245 354 12 16 25.31205 118.1879
351 354 13 16 6.529063 118.1879
352 354 14 16 30.24163 118.1879
353 354 15 16 918.7142 118.1879
354 354 16 16 236.3757 118.1879
355 354 17 16 659.1144 118.1879
461 354 18 16 13.73836 118.1879
462 354 19 16 20.11976 118.1879
463 354 20 16 13.54396 118.1879
471 354 21 16 10.89371 118.1879
472 354 22 16 11.79651 118.1879
473 354 23 16 9.245332 118.1879
481 354 24 16 14.10944 118.1879
482 354 25 16 37.79193 118.1879
483 354 26 16 19.43755 118.1879
484 354 27 16 18.14982 118.1879
591 354 28 16 14.31118 118.1879
592 354 29 16 41.16471 118.1879
593 354 30 16 111.4125 118.1879
101 355 1 17 3.405967 53.97449
102 355 2 17 2.54418 53.97449
111 355 3 17 .9846078 53.97449
121 355 4 17 5.231572 53.97449
122 355 5 17 14.54708 53.97449
131 355 6 17 11.30231 53.97449
132 355 7 17 6.033308 53.97449
241 355 8 17 20.33509 53.97449
242 355 9 17 .2209201 53.97449
243 355 10 17 119.1605 53.97449
244 355 11 17 582.3026 53.97449
245 355 12 17 8.717554 53.97449
351 355 13 17 2.340522 53.97449
352 355 14 17 7.906384 53.97449
353 355 15 17 96.87122 53.97449
354 355 16 17 592.9641 53.97449
355 355 17 17 107.949 53.97449
461 355 18 17 3.852282 53.97449
462 355 19 17 6.173264 53.97449
463 355 20 17 2.932239 53.97449
471 355 21 17 3.094125 53.97449
472 355 22 17 3.119262 53.97449
473 355 23 17 3.159863 53.97449
481 355 24 17 4.599461 53.97449
482 355 25 17 9.549362 53.97449
483 355 26 17 3.788556 53.97449
484 355 27 17 4.102352 53.97449
591 355 28 17 4.341608 53.97449
592 355 29 17 10.38517 53.97449
593 355 30 17 31.29495 53.97449
101 461 1 18 2.682073 3.289597
102 461 2 18 1.338334 3.289597
111 461 3 18 .1537035 3.289597
121 461 4 18 .8630141 3.289597
122 461 5 18 1.349614 3.289597
131 461 6 18 1.358898 3.289597
132 461 7 18 .5955622 3.289597
241 461 8 18 .8597692 3.289597
242 461 9 18 .1012324 3.289597
243 461 10 18 12.10806 3.289597
244 461 11 18 17.40129 3.289597
245 461 12 18 3.568255 3.289597
351 461 13 18 .4401081 3.289597
352 461 14 18 .5668281 3.289597
353 461 15 18 2.755475 3.289597
354 461 16 18 14.07037 3.289597
355 461 17 18 3.56336 3.289597
461 461 18 18 6.579195 3.289597
462 461 19 18 1.325234 3.289597
463 461 20 18 .6147297 3.289597
471 461 21 18 2.590591 3.289597
472 461 22 18 1.085953 3.289597
473 461 23 18 .9021518 3.289597
481 461 24 18 2.140641 3.289597
482 461 25 18 4.330854 3.289597
483 461 26 18 3.147734 3.289597
484 461 27 18 1.512517 3.289597
591 461 28 18 1.077084 3.289597
592 461 29 18 3.721736 3.289597
593 461 30 18 9.17314 3.289597
101 462 1 19 .8445358 4.481283
102 462 2 19 .9259979 4.481283
111 462 3 19 .1349421 4.481283
121 462 4 19 .6577985 4.481283
122 462 5 19 2.065633 4.481283
131 462 6 19 1.468277 4.481283
132 462 7 19 .5460517 4.481283
241 462 8 19 1.270061 4.481283
242 462 9 19 .0658398 4.481283
243 462 10 19 16.04699 4.481283
244 462 11 19 24.95483 4.481283
245 462 12 19 1.60519 4.481283
351 462 13 19 .5652224 4.481283
352 462 14 19 .9462745 4.481283
353 462 15 19 5.821905 4.481283
354 462 16 19 23.25215 4.481283
355 462 17 19 6.150958 4.481283
461 462 18 19 1.28564 4.481283
462 462 19 19 8.962565 4.481283
463 462 20 19 12.65833 4.481283
471 462 21 19 .7522383 4.481283
472 462 22 19 2.867131 4.481283
473 462 23 19 2.406074 4.481283
481 462 24 19 1.070341 4.481283
482 462 25 19 4.746034 4.481283
483 462 26 19 2.043398 4.481283
484 462 27 19 1.728722 4.481283
591 462 28 19 .7534904 4.481283
592 462 29 19 3.51028 4.481283
593 462 30 19 8.812875 4.481283
101 463 1 20 .5346969 2.637708
102 463 2 20 .4500803 2.637708
111 463 3 20 .0798213 2.637708
121 463 4 20 .3977881 2.637708
122 463 5 20 .7844314 2.637708
131 463 6 20 .749409 2.637708
132 463 7 20 .3258389 2.637708
241 463 8 20 .6850545 2.637708
242 463 9 20 .0294844 2.637708
243 463 10 20 8.775261 2.637708
244 463 11 20 12.76447 2.637708
245 463 12 20 1.114435 2.637708
351 463 13 20 .3750885 2.637708
352 463 14 20 .5939589 2.637708
353 463 15 20 2.582026 2.637708
354 463 16 20 15.58113 2.637708
355 463 17 20 3.24116 2.637708
461 463 18 20 .6296129 2.637708
462 463 19 20 11.7622 2.637708
463 463 20 20 5.275417 2.637708
471 463 21 20 .4415536 2.637708
472 463 22 20 1.278156 2.637708
473 463 23 20 1.267425 2.637708
481 463 24 20 .5580255 2.637708
482 463 25 20 2.594866 2.637708
483 463 26 20 .9738093 2.637708
484 463 27 20 1.024356 2.637708
591 463 28 20 .3434987 2.637708
592 463 29 20 2.013602 2.637708
593 463 30 20 4.542308 2.637708
101 471 1 21 3.23023 2.614863
102 471 2 21 .9690798 2.614863
111 471 3 21 .1336595 2.614863
121 471 4 21 .591541 2.614863
122 471 5 21 1.116925 2.614863
131 471 6 21 1.093711 2.614863
132 471 7 21 .4013762 2.614863
241 471 8 21 .6529023 2.614863
242 471 9 21 .1373449 2.614863
243 471 10 21 10.2073 2.614863
244 471 11 21 14.28656 2.614863
245 471 12 21 3.83926 2.614863
351 471 13 21 .2935345 2.614863
352 471 14 21 .3403098 2.614863
353 471 15 21 1.613512 2.614863
354 471 16 21 8.273234 2.614863
355 471 17 21 2.766465 2.614863
461 471 18 21 2.580734 2.614863
462 471 19 21 .899717 2.614863
463 471 20 21 .4004765 2.614863
471 471 21 21 5.229726 2.614863
472 471 22 21 .7782169 2.614863
473 471 23 21 .4543716 2.614863
481 471 24 21 2.041255 2.614863
482 471 25 21 3.083205 2.614863
483 471 26 21 2.300992 2.614863
484 471 27 21 1.092413 2.614863
591 471 28 21 .7103702 2.614863
592 471 29 21 3.132072 2.614863
593 471 30 21 8.410255 2.614863
101 472 1 22 .7892087 2.922747
102 472 2 22 1.072298 2.922747
111 472 3 22 .0995627 2.922747
121 472 4 22 .4935371 2.922747
122 472 5 22 1.181131 2.922747
131 472 6 22 .8092356 2.922747
132 472 7 22 .3660709 2.922747
241 472 8 22 .6811072 2.922747
242 472 9 22 .0547464 2.922747
243 472 10 22 8.617007 2.922747
244 472 11 22 11.90455 2.922747
245 472 12 22 1.569034 2.922747
351 472 13 22 .3983583 2.922747
352 472 14 22 .473575 2.922747
353 472 15 22 2.593007 2.922747
354 472 16 22 13.16702 2.922747
355 472 17 22 3.90817 2.922747
461 472 18 22 1.225316 2.922747
462 472 19 22 2.691674 2.922747
463 472 20 22 1.500194 2.922747
471 472 21 22 .8495651 2.922747
472 472 22 22 5.845493 2.922747
473 472 23 22 3.761431 2.922747
481 472 24 22 .7004476 2.922747
482 472 25 22 7.402507 2.922747
483 472 26 22 2.229273 2.922747
484 472 27 22 2.704446 2.922747
591 472 28 22 .5151777 2.922747
592 472 29 22 4.307865 2.922747
593 472 30 22 8.694145 2.922747
101 473 1 23 .6049659 2.578331
102 473 2 23 .7672256 2.578331
111 473 3 23 .1061587 2.578331
121 473 4 23 .4184558 2.578331
122 473 5 23 1.169227 2.578331
131 473 6 23 .9381855 2.578331
132 473 7 23 .3677243 2.578331
241 473 8 23 .6841372 2.578331
242 473 9 23 .0459628 2.578331
243 473 10 23 8.392096 2.578331
244 473 11 23 12.47408 2.578331
245 473 12 23 1.131396 2.578331
351 473 13 23 .2992302 2.578331
352 473 14 23 .4202069 2.578331
353 473 15 23 2.132293 2.578331
354 473 16 23 12.42814 2.578331
355 473 17 23 2.625157 2.578331
461 473 18 23 .7852084 2.578331
462 473 19 23 2.366753 2.578331
463 473 20 23 1.103652 2.578331
471 473 21 23 .5171224 2.578331
472 473 22 23 3.901644 2.578331
473 473 23 23 5.156661 2.578331
481 473 24 23 .7275885 2.578331
482 473 25 23 6.056978 2.578331
483 473 26 23 1.888646 2.578331
484 473 27 23 2.689323 2.578331
591 473 28 23 .3749638 2.578331
592 473 29 23 3.467207 2.578331
593 473 30 23 5.887862 2.578331
101 481 1 24 4.897433 7.882193
102 481 2 24 .9622745 7.882193
111 481 3 24 .2627215 7.882193
121 481 4 24 1.202216 7.882193
122 481 5 24 2.652091 7.882193
131 481 6 24 1.93112 7.882193
132 481 7 24 .7316324 7.882193
241 481 8 24 .8915204 7.882193
242 481 9 24 .1308626 7.882193
243 481 10 24 23.22725 7.882193
244 481 11 24 23.54587 7.882193
245 481 12 24 116.8877 7.882193
351 481 13 24 .3272352 7.882193
352 481 14 24 .5957242 7.882193
353 481 15 24 2.813446 7.882193
354 481 16 24 14.29857 7.882193
355 481 17 24 5.220682 7.882193
461 481 18 24 2.344301 7.882193
462 481 19 24 .9299088 7.882193
463 481 20 24 .486625 7.882193
471 481 21 24 1.856828 7.882193
472 481 22 24 .9854689 7.882193
473 481 23 24 .7313351 7.882193
481 481 24 24 15.76439 7.882193
482 481 25 24 2.599198 7.882193
483 481 26 24 1.905714 7.882193
484 481 27 24 1.288223 7.882193
591 481 28 24 1.613726 7.882193
592 481 29 24 4.245728 7.882193
593 481 30 24 9.018172 7.882193
101 482 1 25 2.813735 13.03192
102 482 2 25 6.507525 13.03192
111 482 3 25 .4507686 13.03192
121 482 4 25 1.80493 13.03192
122 482 5 25 4.982612 13.03192
131 482 6 25 3.613688 13.03192
132 482 7 25 1.698768 13.03192
241 482 8 25 2.42042 13.03192
242 482 9 25 .3498087 13.03192
243 482 10 25 35.25282 13.03192
244 482 11 25 50.24341 13.03192
245 482 12 25 4.903474 13.03192
351 482 13 25 .9230322 13.03192
352 482 14 25 1.379354 13.03192
353 482 15 25 7.383812 13.03192
354 482 16 25 43.8739 13.03192
355 482 17 25 12.44399 13.03192
461 482 18 25 5.17246 13.03192
462 482 19 25 4.62015 13.03192
463 482 20 25 2.443679 13.03192
471 482 21 25 3.737987 13.03192
472 482 22 25 7.387153 13.03192
473 482 23 25 6.454545 13.03192
481 482 24 25 3.683079 13.03192
482 482 25 25 26.06384 13.03192
483 482 26 25 15.95261 13.03192
484 482 27 25 54.48775 13.03192
591 482 28 25 1.946522 13.03192
592 482 29 25 32.50694 13.03192
593 482 30 25 58.48678 13.03192
101 483 1 26 2.399267 5.983328
102 483 2 26 11.89026 5.983328
111 483 3 26 .2137552 5.983328
121 483 4 26 .9874794 5.983328
122 483 5 26 2.013303 5.983328
131 483 6 26 1.340392 5.983328
132 483 7 26 .7876733 5.983328
241 483 8 26 .8837765 5.983328
242 483 9 26 .1980257 5.983328
243 483 10 26 19.07585 5.983328
244 483 11 26 24.08252 5.983328
245 483 12 26 3.627874 5.983328
351 483 13 26 .6204169 5.983328
352 483 14 26 .5978293 5.983328
353 483 15 26 3.598271 5.983328
354 483 16 26 16.6369 5.983328
355 483 17 26 4.639717 5.983328
461 483 18 26 2.815066 5.983328
462 483 19 26 2.103868 5.983328
463 483 20 26 .9635407 5.983328
471 483 21 26 2.026418 5.983328
472 483 22 26 2.42018 5.983328
473 483 23 26 1.713039 5.983328
481 483 24 26 1.844321 5.983328
482 483 25 26 17.86257 5.983328
483 483 26 26 11.96666 5.983328
484 483 27 26 6.154929 5.983328
591 483 28 26 .7415979 5.983328
592 483 29 26 14.61228 5.983328
593 483 30 26 26.66538 5.983328
101 484 1 27 1.25566 6.102193
102 484 2 27 2.071421 6.102193
111 484 3 27 .1621791 6.102193
121 484 4 27 .774131 6.102193
122 484 5 27 1.471512 6.102193
131 484 6 27 1.374921 6.102193
132 484 7 27 .6386908 6.102193
241 484 8 27 .9265013 6.102193
242 484 9 27 .0964706 6.102193
243 484 10 27 13.9577 6.102193
244 484 11 27 20.89296 6.102193
245 484 12 27 2.370148 6.102193
351 484 13 27 .3853835 6.102193
352 484 14 27 .656321 6.102193
353 484 15 27 3.550455 6.102193
354 484 16 27 18.08148 6.102193
355 484 17 27 4.450966 6.102193
461 484 18 27 1.463207 6.102193
462 484 19 27 1.799444 6.102193
463 484 20 27 1.223961 6.102193
471 484 21 27 1.199818 6.102193
472 484 22 27 3.628652 6.102193
473 484 23 27 2.502085 6.102193
481 484 24 27 1.243527 6.102193
482 484 25 27 55.40498 6.102193
483 484 26 27 5.401904 6.102193
484 484 27 27 12.20439 6.102193
591 484 28 27 .6974626 6.102193
592 484 29 27 10.6825 6.102193
593 484 30 27 18.59915 6.102193
101 591 1 28 1.041462 3.439357
102 591 2 28 .4793383 3.439357
111 591 3 28 .1789729 3.439357
121 591 4 28 .8233702 3.439357
122 591 5 28 1.801885 3.439357
131 591 6 28 1.705886 3.439357
132 591 7 28 .6595116 3.439357
241 591 8 28 .9854918 3.439357
242 591 9 28 .0425705 3.439357
243 591 10 28 26.42547 3.439357
244 591 11 28 26.01386 3.439357
245 591 12 28 2.44688 3.439357
351 591 13 28 .3486114 3.439357
352 591 14 28 .6148738 3.439357
353 591 15 28 2.44935 3.439357
354 591 16 28 12.69419 3.439357
355 591 17 28 4.671099 3.439357
461 591 18 28 .8890895 3.439357
462 591 19 28 .7982063 3.439357
463 591 20 28 .4337971 3.439357
471 591 21 28 .772626 3.439357
472 591 22 28 .5678632 3.439357
473 591 23 28 .4690757 3.439357
481 591 24 28 1.513613 3.439357
482 591 25 28 2.011666 3.439357
483 591 26 28 .8995165 3.439357
484 591 27 28 .7557156 3.439357
591 591 28 28 6.878714 3.439357
592 591 29 28 1.873378 3.439357
593 591 30 28 5.37398 3.439357
101 592 1 29 3.834862 12.64563
102 592 2 29 6.588833 12.64563
111 592 3 29 .4508494 12.64563
121 592 4 29 1.85386 12.64563
122 592 5 29 5.726243 12.64563
131 592 6 29 4.0785 12.64563
132 592 7 29 1.461158 12.64563
241 592 8 29 2.193067 12.64563
242 592 9 29 .4623606 12.64563
243 592 10 29 37.09632 12.64563
244 592 11 29 42.64539 12.64563
245 592 12 29 5.955435 12.64563
351 592 13 29 .8936627 12.64563
352 592 14 29 1.236049 12.64563
353 592 15 29 8.448821 12.64563
354 592 16 29 29.88276 12.64563
355 592 17 29 11.764 12.64563
461 592 18 29 3.729395 12.64563
462 592 19 29 2.981128 12.64563
463 592 20 29 1.980407 12.64563
471 592 21 29 3.43878 12.64563
472 592 22 29 4.65206 12.64563
473 592 23 29 3.267869 12.64563
481 592 24 29 3.527103 12.64563
482 592 25 29 31.76192 12.64563
483 592 26 29 17.47024 12.64563
484 592 27 29 12.22315 12.64563
591 592 28 29 1.827119 12.64563
592 592 29 29 25.29125 12.64563
593 592 30 29 115.2918 12.64563
101 593 1 30 9.936754 24.86592
102 593 2 30 9.267147 24.86592
111 593 3 30 1.079644 24.86592
121 593 4 30 6.345265 24.86592
122 593 5 30 14.07956 24.86592
131 593 6 30 9.435251 24.86592
132 593 7 30 3.884198 24.86592
241 593 8 30 4.76874 24.86592
242 593 9 30 1.173859 24.86592
243 593 10 30 103.8737 24.86592
244 593 11 30 122.9397 24.86592
245 593 12 30 14.31013 24.86592
351 593 13 30 1.705533 24.86592
352 593 14 30 3.558735 24.86592
353 593 15 30 19.4629 24.86592
354 593 16 30 79.90703 24.86592
355 593 17 30 23.87 24.86592
461 593 18 30 9.650484 24.86592
462 593 19 30 8.723811 24.86592
463 593 20 30 4.574611 24.86592
471 593 21 30 8.214936 24.86592
472 593 22 30 7.413834 24.86592
473 593 23 30 7.748879 24.86592
481 593 24 30 10.45162 24.86592
482 593 25 30 50.73908 24.86592
483 593 26 30 20.90086 24.86592
484 593 27 30 21.62249 24.86592
591 593 28 30 4.909937 24.86592
592 593 29 30 136.5628 24.86592
593 593 30 30 49.73183 24.86592
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link href='https://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.3/normalize.min.css' rel='stylesheet' type='text/css'>
<script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/topojson/1.6.19/topojson.min.js"></script>
<style>
body {
background-color: #333;
}
.map {
position: relative;
display: block;
clear: both;
}
.topbar {
position: absolute;
display: block;
clear: both;
color: #eee;
top: 50px;
right: 50px;
background: none;
text-align: center;
}
form, select, span {
/* text-align: center;*/
display: inline-block;
float: left;
}
.background {
fill: #333;
pointer-events: all;
}
.ers {
opacity: 0.85;
/* fill: #444;*/
cursor: pointer;
}
.terr, .state {
opacity: 0.85;
fill: #333;
}
.ers:hover {
opacity: 1;
}
/* The hover and mouseover areas of .ers are different. Sometimes shows name/info but doesn't activate hover class */
.ers.active {
opacity: 1;
}
path {
stroke: #fff;
stroke-width: 0.05;
stroke-linejoin: round;
stroke-linecap: round;
}
.border {
fill: none;
stroke: #fff;
stroke-linejoin: round;
stroke-linecap: round;
}
rect {
max-width: 100%;
vector-effect: non-scaling-stroke;
}
text {
cursor: default;
fill: #111;
font-family: 'Helvetica Neue', Arial, sans-serif;
font-size: 4px;
margin: 0px;
padding: 1px;
}
.text {
font-family: 'Helvetica Neue', Arial, sans-serif;
font-size: 4px;
}
.place-label {
font-size: 3px;
fill: #FFFFFF;
}
.container {
width: 100%;
height: 0;
padding-bottom: 100%;
position: relative;
}
svg {
position: absolute;
top: 0;
left: 0;
}
</style>
</head>
<body>
<div class="map container">
<div class="topbar">
</div>
</div>
<script>
var p = {
max_line_w: 13,
line_w_exp: 1.0296361807650962,
min_opacity: 1, //.1502965352200607,
min_line_w: .03001779211320364,
from_color: d3.hcl(100,100,100).toString(), //"#9999FF", //"#FF9d00", //"#ff6252",
mid_color: d3.hcl(200,100,100).toString(), //"#FFFFFF", //"rgba(191,202,210,1)",
to_color: d3.hcl(300,100,100).toString(), //"#FF9999" //"#64a2a2"
}
var features,
centered,
active = d3.select(null);
var svg = d3.select(".map")
.append("svg")
.on("click", stopped, true);
width = 300; //svg.node().getBoundingClientRect().width;
height = 200; //svg.node().getBoundingClientRect().height;
svg.attr({
viewBox: 0 + " " + 0 + " " + width + " " + height
});
svg.attr("preserveAspectRatio", "xMinYMin meet");
var formatNumber = d3.format(",.1f");
var proj = d3.geo.albers()
.center([9.5,52.5])
.rotate([100,0])
.parallels([52,60])
.scale(350)
.translate([width/2, height/2]);
var path = d3.geo.path()
.projection(proj);
var zoom = d3.behavior.zoom()
.translate([0, 0])
.scale(1)
.scaleExtent([1, 16.5])
.center([width/2,height/2])
.size([width, height])
.on("zoom", zoomed);
var rect = svg.append("rect")
.attr("class", "background")
.attr("width", width)
.attr("height", height)
.on("click", reset);
var R = svg.append("defs");
var g2=svg.append("g")
.attr("transform", "translate(" + width/2 + "," + height/2 + ")");
var g=g2.append("g"); // for da map.
svg
.call(zoom) // delete this line to disable free zooming
.call(zoom.event);
d3.json("us.json", function(error, can){
if (error) return console.error(error);
features=topojson.feature(can, can.objects.nation).features;
g.selectAll(".state")
.data(features) //topojson.feature(can, can.objects.ers).features)
.enter().append("path")
.attr("class", function(d) {
return "state";
})
.attr("d", path)
.style("fill", d3.hcl("hsl(0,0%,20%)"));
// g.append("path")
// .datum(topojson.mesh(can, can.objects.provs, function(a,b) { return a!==b || a===b; }))
// .attr("d",path)
// .attr("class","border");
terr();
});
function terr() {
d3.json("terr.json", function(error, terr){
if (error) return console.error(error);
features=topojson.feature(terr, terr.objects.nation).features;
g.selectAll(".terr")
.data(features) //topojson.feature(can, can.objects.ers).features)
.enter().append("path")
.attr("class", function(d) {
return "terr";
})
.attr("d", path)
.style("fill", d3.hcl("hsl(0,0%,20%)"));
// g.append("path")
// .datum(topojson.mesh(can, can.objects.provs, function(a,b) { return a!==b || a===b; }))
// .attr("d",path)
// .attr("class","border");
ers();
});
}
function ers() {
d3.json("can.json", function(error, can) {
if (error) return console.error(error);
jsonReady(can);
});
}
function jsonReady(can) {
features=topojson.feature(can, can.objects.ers).features;
g.selectAll(".ers")
.data(features) //topojson.feature(can, can.objects.ers).features)
.enter().append("path")
.attr("class", function(d) {
return "ers";
})
.attr("d", path)
.style("fill", d3.hcl("hsl(0,0%,27%)"))
// .on('mouseover', function(d) {
// if (parseInt(d.id,10)<6000) {
// return erInfo(d);
// }
// })
.on('click', clicked);
g.append("path")
.datum(topojson.mesh(can,can.objects.provs, function(a,b) { return a!==b || a===b; }))
.attr("d",path)
.attr("class","border");
var nnodes = [];
for (var f in features) {
nnodes.push({
'id': features[f].id,
'name': features[f].properties.name
// 'x': proj([centroids[f].POINT_X,centroids[f].POINT_Y])[0], //path.centroid(features[f])[0],
// 'y': proj([centroids[f].POINT_X,centroids[f].POINT_Y])[1] //path.centroid(features[f])[1]
})
}
var cities = [{name: "Toronto", coordinates: [-79.4163000, 43.7001100]},
{name: "Vancouver", coordinates: [-123.1193, 49.24966]},
{name: "Montreal", coordinates: [-73.587, 45.5088]},
{name: "Calgary", coordinates: [-114.08529, 51.05011]},
{name: "Halifax", coordinates: [-63.5723900, 44.64533]},
{name: "Winnipeg", coordinates: [-97.14704, 49.8844]},
{name: "Regina", coordinates: [-104.6178, 50.4500]}
]
g.append("g")
.attr("class", "bubble")
.selectAll("circle")
.data(cities) //console.log(d); }) // try to filter here.
.enter()
.append("circle")
.attr("transform", function(d, i) {
// console.log(proj(d.coordinates));
return "translate(" + proj(d.coordinates) + ")";
})
.style("pointer-events", "none")
.style("fill", "#FFFFFF")
.attr("r", 0.5);
g.selectAll(".place-label")
.data(cities) //topojson.feature(uk, uk.objects.places).features)
.enter().append("text")
.attr("class", "place-label")
.attr("transform", function(d) { return "translate(" + proj(d.coordinates) + ")"; })
.style("pointer-events", "none")
.attr("dx", ".35em")
.attr("dy", ".35em")
.text(function(d) { return d.name; });
d3.csv("flows.csv", function(error, data) {
csvReady(can, data, nnodes);
});
}
function csvReady(can, data, nnodes) {
var eedges=[];
var max=0,
min=Number.MAX_VALUE;
for (var i in data) {
var edge=data[i];
var flow=parseFloat(edge.value,10);
// if (flow > 0 && edge.o!==edge.d) {
eedges.push({
'source': edge.o-1, // id prob needs to be a number.
'target': edge.d-1,
'value': flow
// 'line': linkArc(nnodes[edge.o-1], nnodes[edge.d-1]) // could try to transition this.
});
min = Math.min(min, flow);
max = Math.max(max, flow);
// }
//*/
}
var new_scale_w = d3.scale.linear().domain([min, max]).range([0, 2]);
var new_scale_v = d3.scale.log().domain([min, max]).range([0, 1]);
features.forEach(function(d,i) {
// d.imports = aggregate(eedges, i, "target");
// d.exports = aggregate(eedges, i, "source");
d.total = aggregate(eedges, i, "both");
// d.withinER = d.total - d.imports - d.exports;
});
function aggregate(edges, erNode, direction) {
var result = 0;
edges.forEach(function(d) {
if (direction === "both" && (d["source"] === erNode || d["target"] === erNode)) {
result += d.value;
}
else if (d[direction] === erNode && (d["source"] !== d["target"])) {
result += d.value;
}
});
return result;
}
drawPleth(); // this won't go until forceedgebundling is done for some reason.
}
function drawPleth() {
var color = d3.scale.linear()
.domain(d3.extent(features.map(function(d) { return d.total; })))
.range([d3.hcl(-79,15,18), d3.hcl(110,25,98)]) //[d3.hcl(-79,15,18), d3.hcl(-30,15,18)]) //[d3.hcl("hsl(222,30%,20%)"), d3.hcl("hsl(222,40%,50%)")]) //d3.hcl("hsl(62,100%,90%)")])
.interpolate(d3.interpolateHcl);
var plethbox = document.getElementById('choroswitch');
g.selectAll(".ers")
.style("fill", function(d, i) {
return color(features[i].total);
});
}
function clicked(d) {
if (active.node() === this) return reset();
active.classed("active", false);
active = d3.select(this).classed("active", true);
var centroid = path.centroid(d),
x = centroid[0],
y = centroid[1];
var scale, translate;
if (path.area(d) < 7500) {
scale = 2.5;
} else {
var bounds = path.bounds(d),
dx = bounds[1][0] - bounds[0][0],
dy = bounds[1][1] - bounds[0][1];
x = (bounds[0][0] + bounds[1][0]) / 2;
y = (bounds[0][1] + bounds[1][1]) / 2;
scale = .75 / Math.max(dx / width, dy / height);
}
translate = [width / 2 - scale * x, height / 2 - scale * y];
svg.transition()
.duration(750)
.call(zoom.translate(translate).scale(scale).event);
}
function reset() {
active.classed("active", false);
active = d3.select(null);
}
function zoomed() {
g2.style("stroke-width", 1 / d3.event.scale + "px");
g2.attr("transform", "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")");
}
// If the drag behavior prevents the default click,
// also stop propagation so we don’t click-to-zoom.
function stopped() {
if (d3.event.defaultPrevented) d3.event.stopPropagation();
}
/*
function coordinates(point) {
var scale = zoom.scale(),
translate = zoom.translate();
return [(point[0] - translate[0]) / scale, (point[1] - translate[1]) / scale];
}
function point(coordinates) {
var scale = zoom.scale(),
translate = zoom.translate();
return [coordinates[0] * scale + translate[0] , coordinates[1] * scale + translate[1]];
}
*/
</script>
</body>
</html>
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment