block by armollica e99f78d8f48e681c7d9f1d8dcefc10a6

Declining Share of Manufacturing Jobs

Full Screen

Share of jobs in manufacturing by commuter area from 1990 to the 2016. Hover to isolate an individual commuter area’s series. Data are not seasonally-adjusted.

To keep the size of this graphic down I shrunk each faceted chart based on it’s max y-value while keeping the y-scale consistent across charts. At first I just let the browser float each chart in a container but this left weird gaps between charts. Looked into it and found that fitting irregular shapes into other shapes neatly is called the bin packing problem. I implemented a 2D rectangular bin packing algorithm in JavaScript based on Jukka Jylanki’s C++ implementation of the algorithm. This let me lay the charts out snugly.

This bin packing implementation can be found in this GitHub repository: BinPack. The API is still a bit rough at the moment.

Data come from the Bureau of Labor Statistics. The download-data.sh shell script in this gist repository shows how to download the data in bulk. The clean-data.R R script shows how the data was prepped for the visualization. The little state icons are from ProPublica’s StateFace project.

index.html

area-names.tsv

bin-pack.js

clean-data.R

download-data.sh

state-names.tsv

stateface-regular-webfont.eot

stateface-regular-webfont.woff