Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Grupo 2 - Accidentes por Año
<!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 = [
{"Año": 1908, "name":"accidentes", "Total accidentes": 1},
{"Año": 1909, "name":"accidentes", "Total accidentes": 0},
{"Año": 1910, "name":"accidentes", "Total accidentes": 0},
{"Año": 1911, "name":"accidentes", "Total accidentes": 0},
{"Año": 1912, "name":"accidentes", "Total accidentes": 1},
{"Año": 1913, "name":"accidentes", "Total accidentes": 3},
{"Año": 1914, "name":"accidentes", "Total accidentes": 0},
{"Año": 1915, "name":"accidentes", "Total accidentes": 2},
{"Año": 1916, "name":"accidentes", "Total accidentes": 5},
{"Año": 1917, "name":"accidentes", "Total accidentes": 6},
{"Año": 1918, "name":"accidentes", "Total accidentes": 4},
{"Año": 1919, "name":"accidentes", "Total accidentes": 6},
{"Año": 1920, "name":"accidentes", "Total accidentes": 17},
{"Año": 1921, "name":"accidentes", "Total accidentes": 13},
{"Año": 1922, "name":"accidentes", "Total accidentes": 11},
{"Año": 1923, "name":"accidentes", "Total accidentes": 12},
{"Año": 1924, "name":"accidentes", "Total accidentes": 7},
{"Año": 1925, "name":"accidentes", "Total accidentes": 11},
{"Año": 1926, "name":"accidentes", "Total accidentes": 12},
{"Año": 1927, "name":"accidentes", "Total accidentes": 21},
{"Año": 1928, "name":"accidentes", "Total accidentes": 37},
{"Año": 1929, "name":"accidentes", "Total accidentes": 37},
{"Año": 1930, "name":"accidentes", "Total accidentes": 24},
{"Año": 1931, "name":"accidentes", "Total accidentes": 32},
{"Año": 1932, "name":"accidentes", "Total accidentes": 28},
{"Año": 1933, "name":"accidentes", "Total accidentes": 26},
{"Año": 1934, "name":"accidentes", "Total accidentes": 30},
{"Año": 1935, "name":"accidentes", "Total accidentes": 36},
{"Año": 1936, "name":"accidentes", "Total accidentes": 43},
{"Año": 1937, "name":"accidentes", "Total accidentes": 27},
{"Año": 1938, "name":"accidentes", "Total accidentes": 51},
{"Año": 1939, "name":"accidentes", "Total accidentes": 26},
{"Año": 1940, "name":"accidentes", "Total accidentes": 18},
{"Año": 1941, "name":"accidentes", "Total accidentes": 21},
{"Año": 1942, "name":"accidentes", "Total accidentes": 32},
{"Año": 1943, "name":"accidentes", "Total accidentes": 39},
{"Año": 1944, "name":"accidentes", "Total accidentes": 47},
{"Año": 1945, "name":"accidentes", "Total accidentes": 69},
{"Año": 1946, "name":"accidentes", "Total accidentes": 80},
{"Año": 1947, "name":"accidentes", "Total accidentes": 76},
{"Año": 1948, "name":"accidentes", "Total accidentes": 68},
{"Año": 1949, "name":"accidentes", "Total accidentes": 60},
{"Año": 1950, "name":"accidentes", "Total accidentes": 63},
{"Año": 1951, "name":"accidentes", "Total accidentes": 69},
{"Año": 1952, "name":"accidentes", "Total accidentes": 61},
{"Año": 1953, "name":"accidentes", "Total accidentes": 62},
{"Año": 1954, "name":"accidentes", "Total accidentes": 59},
{"Año": 1955, "name":"accidentes", "Total accidentes": 52},
{"Año": 1956, "name":"accidentes", "Total accidentes": 51},
{"Año": 1957, "name":"accidentes", "Total accidentes": 57},
{"Año": 1958, "name":"accidentes", "Total accidentes": 62},
{"Año": 1959, "name":"accidentes", "Total accidentes": 60},
{"Año": 1960, "name":"accidentes", "Total accidentes": 62},
{"Año": 1961, "name":"accidentes", "Total accidentes": 52},
{"Año": 1962, "name":"accidentes", "Total accidentes": 73},
{"Año": 1963, "name":"accidentes", "Total accidentes": 58},
{"Año": 1964, "name":"accidentes", "Total accidentes": 69},
{"Año": 1965, "name":"accidentes", "Total accidentes": 69},
{"Año": 1966, "name":"accidentes", "Total accidentes": 69},
{"Año": 1967, "name":"accidentes", "Total accidentes": 91},
{"Año": 1968, "name":"accidentes", "Total accidentes": 96},
{"Año": 1969, "name":"accidentes", "Total accidentes": 82},
{"Año": 1970, "name":"accidentes", "Total accidentes": 87},
{"Año": 1971, "name":"accidentes", "Total accidentes": 67},
{"Año": 1972, "name":"accidentes", "Total accidentes": 104},
{"Año": 1973, "name":"accidentes", "Total accidentes": 89},
{"Año": 1974, "name":"accidentes", "Total accidentes": 82},
{"Año": 1975, "name":"accidentes", "Total accidentes": 75},
{"Año": 1976, "name":"accidentes", "Total accidentes": 86},
{"Año": 1977, "name":"accidentes", "Total accidentes": 81},
{"Año": 1978, "name":"accidentes", "Total accidentes": 77},
{"Año": 1979, "name":"accidentes", "Total accidentes": 89},
{"Año": 1980, "name":"accidentes", "Total accidentes": 65},
{"Año": 1981, "name":"accidentes", "Total accidentes": 66},
{"Año": 1982, "name":"accidentes", "Total accidentes": 70},
{"Año": 1983, "name":"accidentes", "Total accidentes": 61},
{"Año": 1984, "name":"accidentes", "Total accidentes": 65},
{"Año": 1985, "name":"accidentes", "Total accidentes": 74},
{"Año": 1986, "name":"accidentes", "Total accidentes": 64},
{"Año": 1987, "name":"accidentes", "Total accidentes": 74},
{"Año": 1988, "name":"accidentes", "Total accidentes": 83},
{"Año": 1989, "name":"accidentes", "Total accidentes": 95},
{"Año": 1990, "name":"accidentes", "Total accidentes": 72},
{"Año": 1991, "name":"accidentes", "Total accidentes": 88},
{"Año": 1992, "name":"accidentes", "Total accidentes": 86},
{"Año": 1993, "name":"accidentes", "Total accidentes": 67},
{"Año": 1994, "name":"accidentes", "Total accidentes": 87},
{"Año": 1995, "name":"accidentes", "Total accidentes": 79},
{"Año": 1996, "name":"accidentes", "Total accidentes": 81},
{"Año": 1997, "name":"accidentes", "Total accidentes": 68},
{"Año": 1998, "name":"accidentes", "Total accidentes": 69},
{"Año": 1999, "name":"accidentes", "Total accidentes": 78},
{"Año": 2000, "name":"accidentes", "Total accidentes": 76},
{"Año": 2001, "name":"accidentes", "Total accidentes": 70},
{"Año": 2002, "name":"accidentes", "Total accidentes": 75},
{"Año": 2003, "name":"accidentes", "Total accidentes": 61},
{"Año": 2004, "name":"accidentes", "Total accidentes": 61},
{"Año": 2005, "name":"accidentes", "Total accidentes": 51},
{"Año": 2006, "name":"accidentes", "Total accidentes": 49},
{"Año": 2007, "name":"accidentes", "Total accidentes": 54},
{"Año": 2008, "name":"accidentes", "Total accidentes": 62},
{"Año": 2009, "name":"accidentes", "Total accidentes": 24}
]
// instantiate d3plus
var visualization = d3plus.viz()
.container("#viz") // container DIV to hold the visualization
.data(sample_data) // data to use with the visualization
.type("line") // visualization type
.id("name") // key for which our data is unique on
.text("name") // key to use for display text
.y("Total accidentes") // key to use for y-axis
.x("Año") // key to use for x-axis
.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.