[ Launch: prototype: d3.geo ] 4743201 by ptvans
[ Launch: prototype: d3.geo ] 4743193 by ptvans
[ Launch: prototype: d3.geo ] 4737103 by ptvans
[ Launch: Tributary inlet ] 4700486 by enjalot
-
-
Save ptvans/4743201 to your computer and use it in GitHub Desktop.
prototype: d3.geo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
country | lon | lat | aribicarobusta | cropseason | y2007 | y2008 | y2009 | y2010 | y2011 | y2012 | member | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Bolivia | -62.7866887 | -16.1779043 | (A) | Apr/Mar | 133 | 135 | 142 | 130 | 147 | 150 | y | |
Brazil | -51.3333976 | -8.4666145 | (A/R) | Apr/Mar | 36070 | 45992 | 39470 | 48095 | 43484 | 50826 | y | |
Burundi | 29.8870575 | -3.3634357 | (A) | Apr/Mar | 133 | 412 | 112 | 353 | 204 | 483 | y | |
Cameroon | 13.1535811 | 4.6125522 | (R/A) | Oct/Sep | 795 | 750 | 750 | 608 | 555 | 850 | y | |
Central African Republic | 19.9981227 | 7.0323598 | (R) | Oct/Sep | 43 | 60 | 93 | 95 | 86 | 100 | y | |
Colombia | -73.7845072 | 2.8930783 | (A) | Oct/Sep | 12516 | 8664 | 8098 | 8523 | 7653 | 8000 | y | |
Costa Rica | -84.0739102 | 10.2735633 | (A) | Oct/Sep | 1771 | 1287 | 1304 | 1392 | 1462 | 1616 | y | |
Côte d'Ivoire | -5.5679458 | 7.9897371 | (R) | Oct/Sep | 2317 | 2397 | 1795 | 982 | 1906 | 2000 | y | |
Cuba | -80.8328748 | 23.0131338 | (A) | Jul/Jun | 7 | 12 | 22 | 26 | 38 | 100 | y | |
Ecuador | -79.3666965 | -1.3397668 | (A/R) | Apr/Mar | 1110 | 691 | 813 | 854 | 1075 | 1000 | y | |
El Salvador | -88.9140683 | 13.8000382 | (A) | Oct/Sep | 1505 | 1450 | 1075 | 1850 | 1163 | 1420 | y | |
Ethiopia | 38.6521203 | 10.2116702 | (A) | Oct/Sep | 5967 | 4949 | 6931 | 7500 | 6008 | 6500 | y | |
Gabon | 11.6899699 | -0.8999695 | (R) | Oct/Sep | 0 | 1 | 1 | 1 | 0 | 1 | y | |
Ghana | -1.0800271 | 8.0300284 | (R) | Oct/Sep | 31 | 27 | 33 | 112 | 122 | 85 | y | |
Guatemala | -89.8988087 | 15.6356088 | (A/R) | Oct/Sep | 4100 | 3785 | 3835 | 3950 | 3840 | 3500 | y | |
Honduras | -84.5978534 | 15.0610686 | (A) | Oct/Sep | 3640 | 3351 | 3403 | 4280 | 5705 | 5400 | y | |
India | 78.6677428 | 22.3511148 | (R/A) | Oct/Sep | 4319 | 3950 | 4794 | 5033 | 5233 | 5258 | y | |
Indonesia | 114.5632032 | -4.7993356 | (R/A) | Apr/Mar | 4474 | 9612 | 11380 | 9129 | 8620 | 10950 | y | |
Kenya | 38.4313975 | 1.4419683 | (A) | Oct/Sep | 652 | 541 | 630 | 658 | 680 | 850 | y | |
Liberia | -9.3658524 | 5.7499721 | (R) | Oct/Sep | 7 | 12 | 13 | 9 | 7 | 10 | y | |
Malawi | 33.9301963 | -13.2687204 | (A) | Apr/Mar | 19 | 21 | 17 | 17 | 27 | 20 | y | |
Mexico | -100.0000375 | 22.5000485 | (A) | Oct/Sep | 4150 | 4651 | 4109 | 3994 | 4546 | 5160 | y | |
Nicaragua | -84.8700308 | 12.3724928 | (A) | Oct/Sep | 1905 | 1445 | 1871 | 1669 | 1774 | 1530 | y | |
Panama | -81.3066246 | 8.3096067 | (A) | Oct/Sep | 176 | 149 | 138 | 114 | 104 | 100 | y | |
Papua New Guinea | 144.2489081 | -5.6816069 | (A/R) | Apr/Mar | 968 | 1028 | 1038 | 870 | 1415 | 1200 | y | |
Philippines | 122.7312101 | 12.7503486 | (R/A) | Jul/Jun | 446 | 587 | 730 | 189 | 180 | 455 | y | |
Rwanda | 30.0644358 | -1.9646631 | (A) | Apr/Mar | 224 | 369 | 259 | 323 | 246 | 400 | y | |
Sierra Leone | -11.8400269 | 8.6400349 | (R) | Oct/Sep | 40 | 86 | 91 | 33 | 45 | 50 | y | |
Tanzania | 35.7878438 | -6.5247123 | (A/R) | Jul/Jun | 810 | 1186 | 675 | 846 | 534 | 918 | y | |
Thailand | 100.83273 | 14.8971921 | (R) | Oct/Sep | 650 | 675 | 795 | 829 | 823 | 850 | y | |
Timor-Leste | 125.8375756 | -8.5151979 | (A) | Apr/Mar | 36 | 48 | 47 | 60 | 44 | 75 | y | |
Togo | 1.0199765 | 8.7800265 | (R) | Oct/Sep | 125 | 138 | 204 | 161 | 142 | 150 | y | |
Uganda | 32.2166578 | 1.5333554 | (R/A) | Oct/Sep | 3449 | 3290 | 2845 | 3203 | 2817 | 3000 | y | |
Vietnam | 108.4265113 | 13.2904027 | (R/A) | Oct/Sep | 16405 | 18438 | 17825 | 19467 | 24058 | 22000 | y | |
Yemen | 53.91152087 | 12.4106362 | (A) | Oct/Sep | 198 | 220 | 135 | 160 | 158 | 200 | y | |
Zambia | 27.5599164 | -14.5186239 | (A) | Jul/Jun | 61 | 35 | 28 | 13 | 14 | 10 | y | |
Zimbabwe | 29.7468414 | -18.4554963 | (A) | Apr/Mar | 31 | 24 | 21 | 10 | 9 | 10 | y | |
Congo | 22.456407 | -4.0335162 | (R/A) | Oct/Sep | 416 | 422 | 346 | 305 | 350 | 450 | n | |
Dominican Republic | -70.3012705 | 19.094175 | (A) | Jul/Jun | 465 | 645 | 352 | 378 | 682 | 550 | n | |
Guinea | -10.7077639 | 10.7230195 | (R) | Oct/Sep | 323 | 505 | 499 | 386 | 369 | 415 | n | |
Haiti | -72.3570972 | 19.1399952 | (A) | Jul/Jun | 359 | 359 | 351 | 350 | 349 | 325 | n | |
Lao | 103.378253 | 20.0171109 | (R) | Oct/Sep | 393 | 406 | 434 | 541 | 468 | 550 | n | |
Madagascar | 46.4416422 | -18.9249604 | (R) | Apr/Mar | 614 | 728 | 457 | 529 | 603 | 575 | n | |
Peru | -75.0458515 | -6.8699697 | (A) | Apr/Mar | 3063 | 3872 | 3286 | 4069 | 5581 | 4750 | n | |
Venezuela | -66.1109318 | 8.0018709 | (A) | Oct/Sep | 1520 | 932 | 1214 | 1202 | 901 | 1000 | n | |
Others | 141 | 151 | 127 | 137 | 145 | 168 | n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"description":"prototype: d3.geo","endpoint":"","display":"svg","public":true,"require":[{"name":"topojson","url":"http://d3js.org/topojson.v0.min.js"}],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"world110.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"style.css":{"default":true,"vim":false,"emacs":false,"fontSize":12},"scheduledarrivals.csv":{"default":true,"vim":false,"emacs":false,"fontSize":12},"realtimearrivals.csv":{"default":true,"vim":false,"emacs":false,"fontSize":12},"coffee.csv":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":true,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var coffee = tributary.coffee; | |
var svg = d3.select("svg"); | |
//console.log(schedule) | |
var width = tributary.sw; | |
var height = tributary.sh; | |
var center = { | |
x: width/2, | |
y: height/2 | |
} | |
var world = tributary.world110; | |
var countries = topojson.object(world, world.objects.land); | |
//SCALE | |
var prod_min = 0; | |
var prod_max = d3.max(coffee, function(d) {return d.y2012}); | |
var days_scale = d3.scale.sqrt() | |
.domain([prod_min, prod_max]) | |
.range([5, 12]); | |
var days_color_scale = d3.scale.linear() | |
.domain([prod_min, prod_max]) | |
.range(["#BAE747", "#1A223D"]) | |
.interpolate(d3.interpolateHcl) | |
//san francisco [-122.4194200, 37.7749300 ] | |
var lonlat = [23.6217, 5.07689 ]; | |
var projection = d3.geo.mercator() | |
.scale(1581) | |
.center(lonlat) | |
.translate([width/2, height/2]) | |
var xy = projection(lonlat); | |
var path = d3.geo.path() | |
.projection(projection); | |
svg.append("path") | |
.attr("transform", "translate(" + [xy[0] - center.x, xy[1] - center.y ] + ")") | |
.attr("d", path(countries)) | |
.classed("land", true); | |
svg.append("circle") | |
.classed("locator", true) | |
.attr({ | |
cx: xy[0], | |
cy: xy[1], | |
r: 283 | |
}) | |
svg.append("g") | |
.attr("id", "producers") | |
var points = svg.select("#producers") | |
.selectAll("circle") | |
.data(coffee) | |
.enter() | |
.append("circle") | |
.classed("producer", true); | |
points | |
.attr("transform", function(d) { | |
var p = projection([d.lon, d.lat]); | |
return "translate(" + p + ")"; | |
}) | |
.attr({ | |
"r": function(d) { | |
return days_scale(d.y2012); | |
}, | |
fill: function(d) { | |
return days_color_scale(d.y2012); | |
}, | |
"fill-opacity": 0.4, | |
"stroke":"#C5EE6D", | |
"stroke-width": 0.5 | |
}) | |
svg.append("g") | |
.attr("id", "realtime") | |
var points = svg.select("#realtime") | |
.selectAll("circle") | |
.data(realtime) | |
.enter() | |
.append("circle") | |
.classed("realtime", true); | |
points | |
.attr("transform", function(d) { | |
var p = projection([d.LONGITUDE, d.LATITUDE]); | |
return "translate(" + p + ")"; | |
}) | |
.attr({ | |
"r": 5 | |
}) | |
//TITLE TEXT | |
var shade = svg.append("rect") | |
shade.attr({ | |
rx:9, | |
x:33, | |
y:32, | |
height:75, | |
width:437, | |
"fill-opacity":0.15 | |
}) | |
var title = svg.append("text") | |
.text("coffee comes from these places") | |
.attr({ | |
"transform": "translate(" + [251, 68] + ")", | |
"text-anchor": "middle", | |
"font-weight": 300, | |
"font-size": 30, | |
"fill-opacity": 0.9, | |
"fill": "#FFFFFF" | |
}) | |
var subtitle = svg.append("text") | |
.text("total production, 60kg. bags of coffee (thousands)") | |
.attr({ | |
"transform": "translate(" + [246, 94] + ")", | |
"text-anchor": "middle", | |
"font-weight": 500, | |
"font-size": 12, | |
"fill": "#3A3A3A" | |
}) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.land { | |
fill: #C9C9C9; | |
stroke: #ffffff; | |
} | |
circle.locator { | |
fill: #A5A5A5; | |
stroke: #F8BB79; | |
stroke-width: 1; | |
fill-opacity: 0.0 | |
} | |
circle.producer { | |
fill: #47AFCF; | |
stroke: #224A69; | |
stroke-width: 0.5; | |
fill-opacity: 0.5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment