Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Grupo 2 - Número de accidentes por década y su respectiva proporción entre accidentes de fuerzas armadas y accidentes civiles
<!doctype html>
<meta charset="utf-8">
<script src="//d3plus.org/js/d3.js"></script>
<script src="//d3plus.org/js/d3plus.js"></script>
<div id="viz"></div>
<script>
var sample_data = [
{"Total de accidentes": 20, "name":" Accidentes fuerzas armadas", "group": "1910-1919"},
{"Total de accidentes": 8, "name":" Accidentes civiles", "group": "1910-1919"},
{"Total de accidentes": 6, "name":" Accidentes fuerzas armadas", "group": "1920-1929"},
{"Total de accidentes": 172, "name":" Accidentes civiles", "group": "1920-1929"},
{"Total de accidentes": 5, "name":" Accidentes fuerzas armadas", "group": "1930-1939"},
{"Total de accidentes": 320, "name":" Accidentes civiles", "group": "1930-1939"},
{"Total de accidentes": 138, "name":" Accidentes fuerzas armadas", "group": "1940-1949"},
{"Total de accidentes": 372, "name":" Accidentes civiles", "group": "1940-1949"},
{"Total de accidentes": 94, "name":" Accidentes fuerzas armadas", "group": "1950-1959"},
{"Total de accidentes": 503, "name":" Accidentes civiles", "group": "1950-1959"},
{"Total de accidentes": 125, "name":" Accidentes fuerzas armadas", "group": "1960-1969"},
{"Total de accidentes": 599, "name":" Accidentes civiles", "group": "1960-1969"},
{"Total de accidentes": 93, "name":" Accidentes fuerzas armadas", "group": "1970-1979"},
{"Total de accidentes": 741, "name":" Accidentes civiles", "group": "1970-1979"},
{"Total de accidentes": 117, "name":" Accidentes fuerzas armadas", "group": "1980-1989"},
{"Total de accidentes": 599, "name":" Accidentes civiles", "group": "1980-1989"},
{"Total de accidentes": 107, "name":" Accidentes fuerzas armadas", "group": "1990-1999"},
{"Total de accidentes": 671, "name":" Accidentes civiles", "group": "1990-1999"},
{"Total de accidentes": 76, "name":" Accidentes fuerzas armadas", "group": "2000-2009"},
{"Total de accidentes": 503, "name":" Accidentes civiles", "group": "2000-2009"}
]
var visualization = d3plus.viz()
.container("#viz")
.data(sample_data)
.type("tree_map")
.id(["group","name"])
.size("Total de accidentes")
.labels({"align": "left", "valign": "top"})
.draw()
</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.