Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Grupo 2 - Aerolíneas con más accidentes (1908-2009)
<!doctype html>
<meta charset="utf-8">
<!-- load D3js -->
<script src="//d3plus.org/js/d3.js"></script>
<!-- load D3plus after D3js -->
<script src="//d3plus.org/js/d3plus.js"></script>
<!-- create container element for visualization -->
<div id="viz"></div>
<script>
// sample data array
var sample_data = [
{"Número de accidentes": 179, "Aerolínea": "Aeroflot"},
{"Número de accidentes": 70, "Aerolínea": "Air France"},
{"Número de accidentes": 70, "Aerolínea": "Deutsche Lufthansa"},
{"Número de accidentes": 59, "Aerolínea": "Air Taxi"},
{"Número de accidentes": 44, "Aerolínea": "China National Aviation Corporation"},
{"Número de accidentes": 44, "Aerolínea": "United Air Lines"},
{"Número de accidentes": 46, "Aerolínea": "Pan American World Airways"},
{"Número de accidentes": 36, "Aerolínea": "American Airlines"},
{"Número de accidentes": 34, "Aerolínea": "Indian Airlines"},
{"Número de accidentes": 33, "Aerolínea": "KLM Royal Dutch Airlines"},
{"Número de accidentes": 33, "Aerolínea": "Philippine Air Lines"},
{"Número de accidentes": 31, "Aerolínea": "Private"},
{"Número de accidentes": 41, "Aerolínea": "Aeropostal"},
{"Número de accidentes": 26, "Aerolínea": "Avianca"},
{"Número de accidentes": 25, "Aerolínea": "Northwest Orient Airlines"}
]
// instantiate d3plus
var visualization = d3plus.viz()
.container("#viz") // container DIV to hold the visualization
.data(sample_data) // data to use with the visualization
.type("tree_map") // visualization type
.id("Aerolínea") // key for which our data is unique on
.size("Número de accidentes") // sizing of blocks
.labels({"align": "left", "valign": "top"})
.draw() // finally, draw the visualization!
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.