Skip to content

Instantly share code, notes, and snippets.

@caged
Created August 26, 2011 01:25
Show Gist options
  • Save caged/1172470 to your computer and use it in GitHub Desktop.
Save caged/1172470 to your computer and use it in GitHub Desktop.
census block heatmap
$.getJSON '/data/mn-blks.json', (data) ->
values = _.uniq(_.map(data.features, (d) -> d.counts[prop]))
color = d3.scale.quantile()
.domain(values)
.range(d3.range(4))
# Add and clasify block-level geography
map.add po.geoJson()
.features(data.features)
.on 'load', (d) ->
_.each(d.features, (f) ->
e = f.element
col = color(f.data.counts[prop])
e.setAttribute('class', "nh q5-#{col}")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment