Last active
February 17, 2018 07:37
-
-
Save jjcruzhernandez/3bc1f4940eb84307f05b482af2b82ea9 to your computer and use it in GitHub Desktop.
BarChart
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
Department | Population | Rates.Property.All | Rates.Property.Burglary | Rates.Property.Larceny | Rates.Property.Motor | Rates.Violent.All | Rates.Violent.Assault | Rates.Violent.Murder | Rates.Violent.Rape | Rates.Violent.Robbery | State | Totals.Property.All | Totals.Property.Burglary | Totals.Property.Larceny | Totals.Property.Motor | Totals.Violent.All | Totals.Violent.Assault | Totals.Violent.Murder | Totals.Violent.Rape | Totals.Violent.Robbery | Year | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Alabaster Police Dept | 7690 | 897.3 | 234.1 | 572.2 | 91 | 234.1 | 182.1 | 13 | 13 | 26 | Alabama | 69 | 18 | 44 | 7 | 18 | 14 | 1 | 1 | 2 | 1984 | |
2 | Alabaster Police Dept | 7749 | 980.8 | 154.9 | 606.5 | 219.4 | 322.6 | 309.7 | 0 | 0 | 12.9 | Alabama | 76 | 12 | 47 | 17 | 25 | 24 | 0 | 0 | 1 | 1985 | |
3 | Alabaster Police Dept | 11379 | 1010.6 | 298.8 | 659.1 | 52.7 | 413 | 404.3 | 0 | 0 | 8.8 | Alabama | 115 | 34 | 75 | 6 | 47 | 46 | 0 | 0 | 1 | 1986 | |
4 | Alabaster Police Dept | 12988 | 1178 | 184.8 | 916.2 | 77 | 377.3 | 346.5 | 7.7 | 0 | 23.1 | Alabama | 153 | 24 | 119 | 10 | 49 | 45 | 1 | 0 | 3 | 1987 | |
5 | Alabaster Police Dept | 13371 | 1174.2 | 261.8 | 852.6 | 59.8 | 261.8 | 209.4 | 7.5 | 7.5 | 37.4 | Alabama | 157 | 35 | 114 | 8 | 35 | 28 | 1 | 1 | 5 | 1988 | |
6 | Alabaster Police Dept | 13203 | 1189.1 | 340.8 | 795.3 | 53 | 272.7 | 227.2 | 0 | 7.6 | 37.9 | Alabama | 157 | 45 | 105 | 7 | 36 | 30 | 0 | 1 | 5 | 1989 | |
7 | Alabaster Police Dept | 14732 | 841.7 | 237.6 | 543 | 61.1 | 210.4 | 142.5 | 13.6 | 6.8 | 47.5 | Alabama | 124 | 35 | 80 | 9 | 31 | 21 | 2 | 1 | 7 | 1990 | |
8 | Alabaster Police Dept | 14908 | 804.9 | 234.8 | 496.4 | 73.8 | 221.4 | 187.8 | 13.4 | 0 | 20.1 | Alabama | 120 | 35 | 74 | 11 | 33 | 28 | 2 | 0 | 3 | 1991 | |
9 | Alabaster Police Dept | 15079 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | Alabama | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1992 | |
10 | Alabaster Police Dept | 16256 | 522.9 | 135.3 | 344.5 | 43.1 | 147.6 | 110.7 | 6.2 | 18.5 | 12.3 | Alabama | 85 | 22 | 56 | 7 | 24 | 18 | 1 | 3 | 2 | 1993 | |
11 | Alabaster Police Dept | 16380 | 592.2 | 109.9 | 439.6 | 42.7 | 140.4 | 91.6 | 0 | 6.1 | 42.7 | Alabama | 97 | 18 | 72 | 7 | 23 | 15 | 0 | 1 | 7 | 1994 | |
12 | Alabaster Police Dept | 17399 | 626.5 | 69 | 505.8 | 51.7 | 172.4 | 114.9 | 5.7 | 11.5 | 40.2 | Alabama | 109 | 12 | 88 | 9 | 30 | 20 | 1 | 2 | 7 | 1995 | |
13 | Alabaster Police Dept | 17480 | 228.8 | 22.9 | 188.8 | 17.2 | 22.9 | 17.2 | 0 | 0 | 5.7 | Alabama | 40 | 4 | 33 | 3 | 4 | 3 | 0 | 0 | 1 | 1996 | |
14 | Alabaster Police Dept | 17668 | 158.5 | 34 | 96.2 | 28.3 | 62.3 | 56.6 | 0 | 0 | 5.7 | Alabama | 28 | 6 | 17 | 5 | 11 | 10 | 0 | 0 | 1 | 1997 | |
15 | Alabaster Police Dept | 21223 | 372.2 | 108.4 | 221.5 | 42.4 | 80.1 | 70.7 | 0 | 0 | 9.4 | Alabama | 79 | 23 | 47 | 9 | 17 | 15 | 0 | 0 | 2 | 1998 | |
16 | Alabaster Police Dept | 23858 | 251.5 | 37.7 | 180.2 | 33.5 | 104.8 | 96.4 | 4.2 | 4.2 | 0 | Alabama | 60 | 9 | 43 | 8 | 25 | 23 | 1 | 1 | 0 | 1999 | |
17 | Alabaster Police Dept | 22707 | 955.7 | 101.3 | 770.7 | 83.7 | 127.7 | 66.1 | 8.8 | 4.4 | 48.4 | Alabama | 217 | 23 | 175 | 19 | 29 | 15 | 2 | 1 | 11 | 2001 | |
18 | Alabaster Police Dept | 22819 | 521.5 | 65.7 | 394.4 | 61.4 | 100.8 | 52.6 | 4.4 | 0 | 43.8 | Alabama | 119 | 15 | 90 | 14 | 23 | 12 | 1 | 0 | 10 | 2002 | |
19 | Alabaster Police Dept | 24956 | 809.4 | 92.2 | 641.1 | 76.1 | 92.2 | 72.1 | 0 | 8 | 12 | Alabama | 202 | 23 | 160 | 19 | 23 | 18 | 0 | 2 | 3 | 2003 | |
20 | Alabaster Police Dept | 25628 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | Alabama | 177 | 44 | 117 | 16 | 14 | 4 | 1 | 1 | 8 | 2004 | |
21 | Alabaster Police Dept | 27766 | 2341 | 140.5 | 2020.5 | 180.1 | 97.2 | 68.4 | 0 | 0 | 28.8 | Alabama | 650 | 39 | 561 | 50 | 27 | 19 | 0 | 0 | 8 | 2006 | |
22 | Alabaster Police Dept | 28904 | 2280 | 235.3 | 1885.6 | 159.1 | 114.2 | 48.4 | 3.5 | 0 | 62.3 | Alabama | 659 | 68 | 545 | 46 | 33 | 14 | 1 | 0 | 18 | 2007 | |
23 | Alabaster Police Dept | 29328 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | Alabama | 616 | 55 | 518 | 43 | 20 | 9 | 0 | 1 | 10 | 2008 | |
24 | Alabaster Police Dept | 30002 | 2116.5 | 273.3 | 1739.9 | 103.3 | 136.7 | 90 | 0 | 6.7 | 40 | Alabama | 635 | 82 | 522 | 31 | 41 | 27 | 0 | 2 | 12 | 2009 | |
25 | Alabaster Police Dept | 30352 | 1696.8 | 72.5 | 1509 | 115.3 | 108.7 | 85.7 | 0 | 0 | 23.1 | Alabama | 515 | 22 | 458 | 35 | 33 | 26 | 0 | 0 | 7 | 2010 | |
26 | Alabaster Police Dept | 30498 | 2151 | 282 | 1773.9 | 95.1 | 193.5 | 150.8 | 6.6 | 3.3 | 32.8 | Alabama | 656 | 86 | 541 | 29 | 59 | 46 | 2 | 1 | 10 | 2011 | |
27 | Alabaster Police Dept | 30923 | 2208.7 | 210.2 | 1891.8 | 106.7 | 158.5 | 132.6 | 0 | 6.5 | 19.4 | Alabama | 683 | 65 | 585 | 33 | 49 | 41 | 0 | 2 | 6 | 2012 |
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 table; | |
function preload() { | |
table = loadTable('alabasterPD.csv', 'csv', 'header'); | |
} | |
function setup() { | |
createCanvas(1000, 700); | |
} | |
function draw(){ | |
clear() | |
var total_Rape = table.getColumn('Totals.Violent.Rape'); | |
var years = table.getColumn('Year'); | |
push(); | |
fill(0,0,0) | |
textSize(30) | |
textStyle(BOLD) | |
text("Alabaster P.D. Rape Crimes", 250, 500) | |
pop() | |
fill(0,0,0) | |
textSize(10); | |
text('# of Rapes', 10, 200); | |
line(99,10,99, 410); | |
textSize(10); | |
text("Years", 410, 450); | |
line(100,400,800, 400); | |
for(var x = 0; x < table.getRowCount(); x++){ | |
var tick1 = map(years[x], min(years), max(years), 110,800) | |
line(tick1,400, tick1,406) | |
} | |
for(var x = 0; x < table.getRowCount(); x++){ | |
var tick1 = map(years[x], min(years), max(years), 110,800) | |
text(years[x], tick1-10, 420) | |
} | |
for(var x = 0; x < table.getRowCount(); x++){ | |
var tick2 = map(total_Rape[x], min(total_Rape), max(total_Rape), 400,10) | |
line(95,tick2, 98,tick2) | |
text(total_Rape[x], 85,tick2) | |
} | |
translate(110,400); | |
for(var x = 0; x < table.getRowCount(); x++){ | |
fill(128, 128, 128) | |
var bar = map(years[x], min(years), max(years), 0, 690) | |
var h = map(total_Rape[x], min(total_Rape), max(total_Rape), 0,390) | |
rect(bar-5, 0,10, -h); | |
if(mouseX-110 > (bar-5) && mouseY-400 < (0) && mouseX-105 < ((bar-5)+10) && mouseY-410 > -h){ | |
fill(0,0,0) | |
textSize(10); | |
text(total_Rape[x], mouseX-110, mouseY-400) | |
} | |
} | |
} |
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
<html> | |
<head> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.0/p5.js"></script> | |
<script src="barGraph.js"></script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment