Open semerj opened 9 years ago
This is super cool, I think a great technique. I like this idea of keeping this issue with a running tally of our different techniques.
composite chart with dc.js: http://dc-js.github.io/dc.js/examples/composite.html
awesome bubble charts with scroll animation: http://muyueh.com/30/co2/show.html and http://muyueh.com/greenhoney/
moar maps: http://youarehere.cc/#/maps/by-topic
dc.js grouped bar chart discussion: https://github.com/dc-js/dc.js/issues/558
@semerj that dc.js discussion is totally fucked. There's no fix, it's just broken. Not going there.
thanks: https://github.com/SFCrime/SFC-viewer/commit/f3a29bc388ad023d74d5bbfa35a2d192a9bffaf0
i've sketched out some scenes/visualizations for the story.
screen 1: pre-drawn polygon on map, no markers. give context.
(scroll down)
screen 2: map w/ polygon, markers from first event-instance. one bar graph showing total # of crimes over time. user filters markers by clicking on bar for respective event-instance.
(scroll down)
screen 3: map w/ polygon, markers colored by event instance. time-slider line chart showing total # of crimes by hour (say, 0 - 72). each event-instance is a different color corresponding to marker colors. user can filter markers using time-slider. consider also adding separate day/night filter for markers.
(scroll down)
screen 4: map w/ polygon, marker color corresponding to type of crime (violent + non-violent, something simple). small multiple bar graphs. each bar graphs showing # of crimes by crime type (violent/non-violent) over time. user filters markers by clicking on bar.
(scroll down)
screen 5: summary page to wrap things up.
1.138381201 * avg.
psql sfpd info247 -c "SELECT count(*) FROM crime where date='2014-5-18';"
b2b = 436
psql sfpd info247 -t -A -F"," -c "SELECT count(*) as c from crime where extract(year from date) = '2014' and dayofweek='Sunday' GROUP BY date;" | awk '{s+=$1} END {print s}'
avg sunday 2014 = 383.25
psql sfpd info247 -t -A -F"," -c "SELECT count(*) as c from crime where extract(year from date) = '2014' GROUP BY date;" | awk '{s+=$1} END {print s}'
avg for 2014 = 411.465753425
SELECT category, count(*) FROM crime where date='2014-5-18' group by category;
category | count
------------------------+-------
DRUNKENNESS | 3
SECONDARY CODES | 3
MISSING PERSON | 17
VANDALISM | 23
NON-CRIMINAL | 63
SUSPICIOUS OCC | 15
EMBEZZLEMENT | 1
BURGLARY | 20
LARCENY/THEFT | 87
OTHER OFFENSES | 70
STOLEN PROPERTY | 4
TRESPASS | 7
ARSON | 1
VEHICLE THEFT | 17
LIQUOR LAWS | 4
ASSAULT | 45
WARRANTS | 13
FRAUD | 4
ROBBERY | 7
FORGERY/COUNTERFEITING | 1
KIDNAPPING | 2
DRUG/NARCOTIC | 22
RUNAWAY | 2
SEX OFFENSES, FORCIBLE | 4
WEAPON LAWS | 1
1.196125908 * avg.
psql sfpd info247 -c "SELECT count(*) FROM crime where date='2014-10-29';"
World Series SF Win Game 7 = 494
psql sfpd info247 -t -A -F"," -c "SELECT count(*) as c from crime where extract(year from date) = '2014' and dayofweek='Wednesday' GROUP BY date;" | awk '{s+=$1} END {print s}'
avg sunday 2014 = 413.471698113
psql sfpd info247 -t -A -F"," -c "SELECT count(*) as c from crime where extract(year from date) = '2014' GROUP BY date;" | awk '{s+=$1} END {print s}'
avg for 2014 = 411.465753425
SELECT category, count(*) FROM crime where date='2014-10-29' group by category;
category | count
-----------------------------+-------
DRUNKENNESS | 3
SECONDARY CODES | 6
MISSING PERSON | 12
VANDALISM | 35
SUSPICIOUS OCC | 17
NON-CRIMINAL | 67
EMBEZZLEMENT | 1
BURGLARY | 17
LARCENY/THEFT | 122
OTHER OFFENSES | 70
STOLEN PROPERTY | 4
BRIBERY | 1
VEHICLE THEFT | 34
LIQUOR LAWS | 1
LOITERING | 1
SUICIDE | 1
ASSAULT | 53
FRAUD | 4
WARRANTS | 11
ROBBERY | 16
FORGERY/COUNTERFEITING | 3
DRUG/NARCOTIC | 5
WEAPON LAWS | 8
DRIVING UNDER THE INFLUENCE | 1
DISORDERLY CONDUCT | 1
@anabranch: Using this as a model, I just plotted some points on a leaflet map using D3 (https://github.com/semerj/leaflet-points-layer).
Nice timeline functionality and it seems extensible to bar charts and other d3 visualizations.
For reference: http://en.wikipedia.org/wiki/2014_World_Series
Year averages:
SELECT category, count(*)::Float/365 FROM crime where extract(year from date) = 2014 group by category;
I like this one from Tulia a lot for baseline comparison. Eliminates the need for separate time/day-of-week graphs. Not sure how useful it is for the individual event-instances though.
A typical weekend in a given polygon isn't going to have a crime occur at each hour or day, so most of the tiles in the Trulia viz will be blank.