Skip to content

Instantly share code, notes, and snippets.

View enactdev's full-sized avatar

Chris A. Williams enactdev

  • Enact Development
  • Washington, DC
View GitHub Profile
@enactdev
enactdev / README.md
Last active January 13, 2022 23:01 — forked from mbostock/.block
Responsive D3 chart

This is basic responsive D3 chart example. It is a fork from Mike Bostock's bar chart "Wrapping Long Labels." This NPR article was also useful.

Changes from Mike Bostock's original in the order they were applied:

  • Add default width and height
  • Use those defaults to calculate non-repsonsive width and height
  • Create the set_vars() function to re-calculate width and height when needed. Call it immediately to correctly set width and height
  • Put the code that draws the chart in a function, drawGraphic. Basically, the code from "var x..." through "svg.selectAll("rect")..."
  • Create the window.onresize funcion

In the future be able to create breakpoints to draw slightly different graphs if space is constrained.

alexa rank website # trackers
19 cnn.com 26
22 espn.go.com 14
29 nytimes.com 44
31 huffingtonpost.com 59
37 buzzfeed.com 25
44 foxnews.com 40
50 washingtonpost.com 41
66 dailymail.co.uk 76
67 cnet.com 37
@enactdev
enactdev / README.md
Last active September 7, 2015 23:17 — forked from mbostock/.block
Knight Data Viz

Placeholder README.md

@enactdev
enactdev / README.md
Last active September 11, 2015 19:00 — forked from mbostock/.block
Website trackers on newssites
@enactdev
enactdev / README.md
Last active September 11, 2015 19:05
Most popular trackers on news websites
@enactdev
enactdev / README.md
Last active October 18, 2016 23:09
Display Delaware in a Leaflet map!
This is a basic Leaflet map showing the state of Delaware. It's a mashup of
[Leaflet's Quick Start Guide](http://leafletjs.com/examples/quick-start/) and
[SitePoint's Basic HTML5 Template](https://www.sitepoint.com/a-basic-html5-template/).
@enactdev
enactdev / README.md
Last active April 12, 2017 02:05
Display Delaware's state Representative districts in a map!

Delaware's state Representative districts

A KML file of the districts was downloaded from opendata.firstmap.delaware.gov

And then converted to GeoJSON with the node project toGeoJSON.

togeojson de_districts_representative.kml > de_districts_representative.json
@enactdev
enactdev / Philly_Council_Districts_2016.geojson
Last active October 14, 2017 12:53
Philly donations by district
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@enactdev
enactdev / Political_Wards.geojson
Last active June 14, 2017 03:04
Philly donations by Ward
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@enactdev
enactdev / README.md
Last active October 18, 2017 00:53
Philly donations by zipcode