Skip to content

Commit

Permalink
#29 remove for loop from js.
Browse files Browse the repository at this point in the history
  • Loading branch information
constanthatz committed Feb 27, 2015
1 parent e800cea commit fddc986
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
11 changes: 6 additions & 5 deletions seattle/seattle/static/js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ var map = L.mapbox.map('map', 'jacques.la14ofjk', {
map.scrollWheelZoom.disable();

function graph() {
dates = [];
for (i = 0; i < data.length; i++) {
data[i].month = new Date(data[i].month*1000*60*60*24);
}
// dates = [];
// for (i = 0; i < data.length; i++) {
// data[i].month = new Date(data[i].month*1000*60*60*24);
// }
// new Date(d.month*1000*60*60*24)

var w = 960,
h = 500,
Expand Down Expand Up @@ -51,7 +52,7 @@ function graph() {
// Transpose the data into layers by type.
var incidents = d3.layout.stack()(["fire", "mvi", "crime"].map(function(incident) {
return data.map(function(d) {
return {x: d.month, y: +d[incident]};
return {x: new Date(d.month*1000*60*60*24), y: +d[incident]};
});
}));

Expand Down
6 changes: 2 additions & 4 deletions seattle/seattle/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,9 @@ def line_plot_lat_long_ajax(request):
try:
incident_types = ['Fire', 'MVI', 'Crime']
output = []
date_time_object_list = []
for inc_type in incident_types:
date_time_object = Incidents_Model.cat_circle(lat, lon, inc_type, radius)
date_time_object_list.append(date_time_object)
output.append(epoch_list(date_time_object))
output.append(epoch_list(
Incidents_Model.cat_circle(lat, lon, inc_type, radius)))
# Count number of db results
db_count = 0
for x in range(3):
Expand Down

0 comments on commit fddc986

Please sign in to comment.