Skip to content

Commit

Permalink
Merge pull request #382 from cfpb/census-tooltips
Browse files Browse the repository at this point in the history
Remove year from tract tooltips
  • Loading branch information
sleitner committed Mar 17, 2016
2 parents 90d2fe2 + 0aba53a commit 7f50d41
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
8 changes: 4 additions & 4 deletions frontend/src/js/drawCircles.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
var circle = L.circle([geo.centlat, geo.centlon],
hmdaStat(data), style );

// We will use the geoid when redrawing
circle.geoid = geo.geoid;
// We will use the tractid when redrawing
circle.tractid = geo.tractid || '';
circle.volume = geo.volume;
circle.type = "tract-circle";
circle.keyCircle = 0;
Expand All @@ -42,7 +42,7 @@

circle.on('mouseover mousemove', function(e){
new L.Rrose({ offset: new L.Point(0,0), closeButton: false, autoPan: false, y_bound: 160 })
.setContent('<div class="bubble-header">Tract '+ circle.geoid +
.setContent('<div class="bubble-header">Tract '+ circle.tractid +
'</div><div class="lar-count"><span class="circle-hover-data">' +data['volume'] +
'</span><span class="circle-hover-label">LAR</span></div><div class="hh-count"><span class="circle-hover-data">' + data['num_households'] +
'</span><span class="circle-hover-label">Households</span></div></div>')
Expand Down Expand Up @@ -84,4 +84,4 @@

/*
END DRAW CIRCLES AND MARKERS SECTION
*/
*/
5 changes: 4 additions & 1 deletion mapusaurus/hmda/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,19 @@ def loan_originations(request):
query = query.filter(action_taken__in=action_taken_selected)

#count on geo_id
query = query.values('geo_id', 'geo__census2010households__total', 'geo__centlat', 'geo__centlon').annotate(volume=Count('geo_id'))
query = query.values('geo_id', 'geo__census2010households__total', 'geo__centlat', 'geo__centlon',
'geo__state', 'geo__county', 'geo__tract').annotate(volume=Count('geo_id'))
return query;

def loan_originations_as_json(request):
records = loan_originations(request)
data = {}
if records:
for row in records:
tract_id = row['geo__state']+row['geo__county']+row['geo__tract']
data[row['geo_id']] = {
'geoid': row['geo_id'],
'tractid': tract_id,
'volume': row['volume'],
'num_households': row['geo__census2010households__total'],
'centlat': row['geo__centlat'],
Expand Down
4 changes: 2 additions & 2 deletions mapusaurus/mapping/static/mapping/js/map.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7f50d41

Please sign in to comment.