Skip to content

Instantly share code, notes, and snippets.

@pachamaltese

pachamaltese/index.html

Last active Sep 15, 2017
Embed
What would you like to do?
Grupo 2 - Accidentes Aéreos
<!doctype html>
<meta charset="utf-8">
<script src="//d3plus.org/js/d3.js"></script>
<script src="//d3plus.org/js/topojson.js"></script>
<script src="//d3plus.org/js/d3plus.js"></script>
<!-- create container element for visualization -->
<div id="viz"></div>
<script>
// sample data array
var sample_data = [
{"Numero de accidentes": 151, "country": "nacan", "name": "Canada"},
{"Numero de accidentes": 1, "country": "octls", "name": "East Timor"},
{"Numero de accidentes": 2, "country": "astkm", "name": "Turkmenistan"},
{"Numero de accidentes": 1, "country": "eultu", "name": "Lithuania"},
{"Numero de accidentes": 4, "country": "askhm", "name": "Cambodia"},
{"Numero de accidentes": 17, "country": "afeth", "name": "Ethiopia"},
{"Numero de accidentes": 45, "country": "saarg", "name": "Argentina"},
{"Numero de accidentes": 49, "country": "sabol", "name": "Bolivia"},
{"Numero de accidentes": 14, "country": "afcmr", "name": "Cameroon"},
{"Numero de accidentes": 2, "country": "afgha", "name": "Ghana"},
{"Numero de accidentes": 16, "country": "assau", "name": "Saudi Arabia"},
{"Numero de accidentes": 2, "country": "ocasm", "name": "American Samoa"},
{"Numero de accidentes": 2, "country": "eusvn", "name": "Slovenia"},
{"Numero de accidentes": 24, "country": "nagtm", "name": "Guatemala"},
{"Numero de accidentes": 4, "country": "askwt", "name": "Kuwait"},
{"Numero de accidentes": 7, "country": "asjor", "name": "Jordan"},
{"Numero de accidentes": 38, "country": "astwn", "name": "Taiwan"},
{"Numero de accidentes": 68, "country": "euesp", "name": "Spain"},
{"Numero de accidentes": 81, "country": "ocaus", "name": "Australia"},
{"Numero de accidentes": 6, "country": "aflbr", "name": "Liberia"},
{"Numero de accidentes": 21, "country": "eunld", "name": "Netherlands"},
{"Numero de accidentes": 32, "country": "aspak", "name": "Pakistan"},
{"Numero de accidentes": 2, "country": "asomn", "name": "Oman"},
{"Numero de accidentes": 6, "country": "aftza", "name": "Tanzania"},
{"Numero de accidentes": 2, "country": "namtq", "name": "Martinique"},
{"Numero de accidentes": 4, "country": "afciv", "name": "Ivory Coast"},
{"Numero de accidentes": 6, "country": "nagrl", "name": "Greenland"},
{"Numero de accidentes": 24, "country": "ocnzl", "name": "New Zealand"},
{"Numero de accidentes": 6, "country": "asyem", "name": "Yemen"},
{"Numero de accidentes": 3, "country": "najam", "name": "Jamaica"},
{"Numero de accidentes": 2, "country": "eualb", "name": "Albania"},
{"Numero de accidentes": 6, "country": "ocwsm", "name": "Samoa"},
{"Numero de accidentes": 6, "country": "asare", "name": "United Arab Emirates"},
{"Numero de accidentes": 7, "country": "ocgum", "name": "Guam"},
{"Numero de accidentes": 132, "country": "asind", "name": "India"},
{"Numero de accidentes": 8, "country": "asaze", "name": "Azerbaijan"},
{"Numero de accidentes": 1, "country": "aflso", "name": "Lesotho"},
{"Numero de accidentes": 23, "country": "afken", "name": "Kenya"},
{"Numero de accidentes": 17, "country": "askor", "name": "South Korea"},
{"Numero de accidentes": 1, "country": "astjk", "name": "Tajikistan"},
{"Numero de accidentes": 31, "country": "astur", "name": "Turkey"},
{"Numero de accidentes": 33, "country": "asafg", "name": "Afghanistan"},
{"Numero de accidentes": 1, "country": "eucze", "name": "Czech Republic"},
{"Numero de accidentes": 6, "country": "afmrt", "name": "Mauritania"},
{"Numero de accidentes": 2, "country": "ocslb", "name": "Solomon Islands"},
{"Numero de accidentes": 1, "country": "natca", "name": "Turks and Caicos Islands"},
{"Numero de accidentes": 7, "country": "asmng", "name": "Mongolia"},
{"Numero de accidentes": 137, "country": "eufra", "name": "France"},
{"Numero de accidentes": 5, "country": "nabmu", "name": "Bermuda"},
{"Numero de accidentes": 2, "country": "eusvk", "name": "Slovakia"},
{"Numero de accidentes": 54, "country": "saper", "name": "Peru"},
{"Numero de accidentes": 26, "country": "aslao", "name": "Laos"},
{"Numero de accidentes": 30, "country": "eunor", "name": "Norway"},
{"Numero de accidentes": 2, "country": "afmwi", "name": "Malawi"},
{"Numero de accidentes": 1, "country": "occok", "name": "Cook Islands"},
{"Numero de accidentes": 1, "country": "afben", "name": "Benin"},
{"Numero de accidentes": 22, "country": "nacub", "name": "Cuba"},
{"Numero de accidentes": 91, "country": "aschn", "name": "China"},
{"Numero de accidentes": 4, "country": "asarm", "name": "Armenia"},
{"Numero de accidentes": 5, "country": "nadom", "name": "Dominican Republic"},
{"Numero de accidentes": 21, "country": "euukr", "name": "Ukraine"},
{"Numero de accidentes": 4, "country": "asbhr", "name": "Bahrain"},
{"Numero de accidentes": 87, "country": "asidn", "name": "Indonesia"},
{"Numero de accidentes": 14, "country": "aflby", "name": "Libya"},
{"Numero de accidentes": 9, "country": "eufin", "name": "Finland"},
{"Numero de accidentes": 3, "country": "afcaf", "name": "Central African Republic"},
{"Numero de accidentes": 1, "country": "afmus", "name": "Mauritius"},
{"Numero de accidentes": 11, "country": "euswe", "name": "Sweden"},
{"Numero de accidentes": 74, "country": "asvnm", "name": "Vietnam"},
{"Numero de accidentes": 1, "country": "navgb", "name": "British Virgin Islands"},
{"Numero de accidentes": 178, "country": "eurus", "name": "Russia"},
{"Numero de accidentes": 10, "country": "eubgr", "name": "Bulgaria"},
{"Numero de accidentes": 1422, "country": "nausa", "name": "United States"},
{"Numero de accidentes": 21, "country": "eurou", "name": "Romania"},
{"Numero de accidentes": 44, "country": "afago", "name": "Angola"},
{"Numero de accidentes": 14, "country": "euprt", "name": "Portugal"},
{"Numero de accidentes": 22, "country": "afzaf", "name": "South Africa"},
{"Numero de accidentes": 13, "country": "nanic", "name": "Nicaragua"},
{"Numero de accidentes": 3, "country": "asqat", "name": "Qatar"},
{"Numero de accidentes": 12, "country": "asmys", "name": "Malaysia"},
{"Numero de accidentes": 4, "country": "euaut", "name": "Austria"},
{"Numero de accidentes": 6, "country": "afmoz", "name": "Mozambique"},
{"Numero de accidentes": 5, "country": "afuga", "name": "Uganda"},
{"Numero de accidentes": 8, "country": "euhun", "name": "Hungary"},
{"Numero de accidentes": 192, "country": "sabra", "name": "Brazil"},
{"Numero de accidentes": 48, "country": "afgin", "name": "Guinea"},
{"Numero de accidentes": 20, "country": "napan", "name": "Panama"},
{"Numero de accidentes": 4, "country": "saguy", "name": "Guyana"},
{"Numero de accidentes": 12, "country": "nacri", "name": "Costa Rica"},
{"Numero de accidentes": 3, "country": "eulux", "name": "Luxembourg"},
{"Numero de accidentes": 10, "country": "nabhs", "name": "Bahamas"},
{"Numero de accidentes": 4, "country": "eugib", "name": "Gibraltar"},
{"Numero de accidentes": 17, "country": "euirl", "name": "Ireland"},
{"Numero de accidentes": 33, "country": "afnga", "name": "Nigeria"},
{"Numero de accidentes": 34, "country": "saecu", "name": "Ecuador"},
{"Numero de accidentes": 3, "country": "asbgd", "name": "Bangladesh"},
{"Numero de accidentes": 1, "country": "navir", "name": "US Virgin Islands"},
{"Numero de accidentes": 1, "country": "asbrn", "name": "Brunei"},
{"Numero de accidentes": 2, "country": "eublr", "name": "Belarus"},
{"Numero de accidentes": 38, "country": "asirn", "name": "Iran"},
{"Numero de accidentes": 19, "country": "afdza", "name": "Algeria"},
{"Numero de accidentes": 5, "country": "naslv", "name": "El Salvador"},
{"Numero de accidentes": 1, "country": "ocmhl", "name": "Marshall Islands"},
{"Numero de accidentes": 24, "country": "sachl", "name": "Chile"},
{"Numero de accidentes": 22, "country": "napri", "name": "Puerto Rico"},
{"Numero de accidentes": 18, "country": "eubel", "name": "Belgium"},
{"Numero de accidentes": 24, "country": "astha", "name": "Thailand"},
{"Numero de accidentes": 6, "country": "nahti", "name": "Haiti"},
{"Numero de accidentes": 1, "country": "nablz", "name": "Belize"},
{"Numero de accidentes": 14, "country": "ashkg", "name": "Hong Kong"},
{"Numero de accidentes": 2, "country": "afsle", "name": "Sierra Leone"},
{"Numero de accidentes": 37, "country": "asgeo", "name": "Georgia"},
{"Numero de accidentes": 6, "country": "afgmb", "name": "Gambia"},
{"Numero de accidentes": 12, "country": "eupol", "name": "Poland"},
{"Numero de accidentes": 1, "country": "eumda", "name": "Moldova"},
{"Numero de accidentes": 25, "country": "afmar", "name": "Morocco"},
{"Numero de accidentes": 1, "country": "afstp", "name": "Principe"},
{"Numero de accidentes": 1, "country": "euhrv", "name": "Croatia"},
{"Numero de accidentes": 2, "country": "ocpyf", "name": "French Polynesia"},
{"Numero de accidentes": 23, "country": "euche", "name": "Switzerland"},
{"Numero de accidentes": 1, "country": "afcpv", "name": "Cape Verde Islands"},
{"Numero de accidentes": 1, "country": "euimn", "name": "Isle of Man"},
{"Numero de accidentes": 5, "country": "euest", "name": "Estonia"},
{"Numero de accidentes": 6, "country": "saury", "name": "Uruguay"},
{"Numero de accidentes": 122, "country": "namex", "name": "Mexico"},
{"Numero de accidentes": 7, "country": "aslbn", "name": "Lebanon"},
{"Numero de accidentes": 9, "country": "asuzb", "name": "Uzbekistan"},
{"Numero de accidentes": 1, "country": "aftun", "name": "Tunisia"},
{"Numero de accidentes": 5, "country": "afdji", "name": "Djibouti"},
{"Numero de accidentes": 2, "country": "afrwa", "name": "Rwanda"},
{"Numero de accidentes": 2, "country": "ocmnp", "name": "Mariana Islands"},
{"Numero de accidentes": 7, "country": "nadma", "name": "Dominica"},
{"Numero de accidentes": 154, "country": "sacol", "name": "Colombia"},
{"Numero de accidentes": 13, "country": "afcod", "name": "Zaire"},
{"Numero de accidentes": 4, "country": "eucyp", "name": "Cyprus"},
{"Numero de accidentes": 2, "country": "nabrb", "name": "Barbados"},
{"Numero de accidentes": 1, "country": "ascck", "name": "Cocos Islands"},
{"Numero de accidentes": 8, "country": "afmdg", "name": "Madagascar"},
{"Numero de accidentes": 79, "country": "euita", "name": "Italy"},
{"Numero de accidentes": 2, "country": "nacuw", "name": "Curacao"},
{"Numero de accidentes": 1, "country": "asbtn", "name": "Bhutan"},
{"Numero de accidentes": 1, "country": "navct", "name": "St. Vincent"},
{"Numero de accidentes": 31, "country": "afsdn", "name": "Sudan"},
{"Numero de accidentes": 26, "country": "asnpl", "name": "Nepal"},
{"Numero de accidentes": 7, "country": "eumlt", "name": "Malta"},
{"Numero de accidentes": 2, "country": "sasur", "name": "Suriname"},
{"Numero de accidentes": 59, "country": "saven", "name": "Venezuela"},
{"Numero de accidentes": 3, "country": "naant", "name": "Netherlands Antilles"},
{"Numero de accidentes": 1, "country": "asisr", "name": "Israel"},
{"Numero de accidentes": 3, "country": "ocumi", "name": "Wake Island"},
{"Numero de accidentes": 6, "country": "euisl", "name": "Iceland"},
{"Numero de accidentes": 5, "country": "afzmb", "name": "Zambia"},
{"Numero de accidentes": 20, "country": "ocpng", "name": "Papua New Guinea"},
{"Numero de accidentes": 3, "country": "afzwe", "name": "Zimbabwe"},
{"Numero de accidentes": 92, "country": "eudeu", "name": "Germany"},
{"Numero de accidentes": 3, "country": "ocvut", "name": "Vanuatu"},
{"Numero de accidentes": 11, "country": "eudnk", "name": "Denmark"},
{"Numero de accidentes": 3, "country": "askaz", "name": "Kazakhstan"},
{"Numero de accidentes": 69, "country": "asphl", "name": "Philippines"},
{"Numero de accidentes": 1, "country": "aferi", "name": "Eritrea"},
{"Numero de accidentes": 2, "country": "askgz", "name": "Kyrgyzstan"},
{"Numero de accidentes": 11, "country": "asirq", "name": "Iraq"},
{"Numero de accidentes": 1, "country": "namsr", "name": "Montserrat"},
{"Numero de accidentes": 4, "country": "eumkd", "name": "Macedonia"},
{"Numero de accidentes": 2, "country": "asprk", "name": "North Korea"},
{"Numero de accidentes": 5, "country": "sapry", "name": "Paraguay"},
{"Numero de accidentes": 2, "country": "eulva", "name": "Latvia"},
{"Numero de accidentes": 46, "country": "asjpn", "name": "Japan"},
{"Numero de accidentes": 9, "country": "assyr", "name": "Syria"},
{"Numero de accidentes": 2, "country": "naglp", "name": "Guadeloupe"},
{"Numero de accidentes": 18, "country": "nahnd", "name": "Honduras"},
{"Numero de accidentes": 12, "country": "asmmr", "name": "Myanmar"},
{"Numero de accidentes": 4, "country": "afgnq", "name": "Equatorial Guinea"},
{"Numero de accidentes": 38, "country": "afegy", "name": "Egypt"},
{"Numero de accidentes": 2, "country": "assgp", "name": "Singapore"},
{"Numero de accidentes": 1, "country": "afbwa", "name": "Botswana"},
{"Numero de accidentes": 3, "country": "eugbr", "name": "United Kingdom"},
{"Numero de accidentes": 1, "country": "anata", "name": "Antarctica"},
{"Numero de accidentes": 44, "country": "afcog", "name": "Congo"},
{"Numero de accidentes": 14, "country": "eursb", "name": "Yugoslavia"},
{"Numero de accidentes": 28, "country": "eugrc", "name": "Greece"},
{"Numero de accidentes": 13, "country": "aslka", "name": "Sri Lanka"},
{"Numero de accidentes": 3, "country": "afnam", "name": "Namibia"},
{"Numero de accidentes": 2, "country": "afcom", "name": "Comoros"}
]
// instantiate d3plus
var visualization = d3plus.viz()
.container("#viz") // container DIV to hold the visualization
.data(sample_data) // data to use with the visualization
.coords("//d3plus.org/topojson/countries.json") // pass topojson coordinates
.type("geo_map") // visualization type
.id("country") // key for which our data is unique on
.text("name") // key to use for display text
.color("Numero de accidentes") // key for coloring countries
.tooltip("Numero de accidentes") // keys to place in tooltip
.draw() // finally, draw the visualization!
.title("Accidentes Aéreos")
</script>
@navidostadian

This comment has been minimized.

Copy link

@navidostadian navidostadian commented Sep 15, 2017

Hi,
Can you please check the id for "Russia". Seems there is a problem with it since it doesn't appear on the map.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment