Skip to main content
100%

Zoomable Choropleth to be gutted

✓ Published0🌍 Public
SSamagoue
Last edited Oct 2, 2018
Created on Oct 2, 2018

This zoomable choropleth of U.S. county unemployment rates shows state-level data that animates to a county-level view when a state is clicked, with the option to zoom back out by clicking a county. Built with D3.js v4, it uses the `d3.geoAlbers` projection, `d3.geoPath`, and `projection.fitExtent()` to smoothly transition the map. The colors encode unemployment data from the BLS, and the code also sets `projection.precision(0)` to prevent interpolation issues during zoom animations.

AI-generated description

Block-a-Day #11. Clicking on a state zooms the map to that state and shows county-level data.

Data Sources: BLS.

What I Learned: Trying out the new projection.fitExtent(). In the process, learned about adaptive resampling, which can break interpolation by changing the number of coordinates in a path at different zoom levels. Fixed the resulting bug by setting projection.precision() to 0, effectively turning off resampling.

What I'd Do With More Time: Finding a way to include Alaska and Hawaii is an obvious next step (albersUSA didn't immediately work with this technique). Could probably use more detailed county shapefiles.

Block-a-Day

Just what it sounds like. For fifteen days, I will make a D3.js v4 block every single day. Rules:

  1. Ideas over implementation. Do something novel, don't sweat the details.
  2. No more than two hours can be spent on coding (give or take).
  3. Every. Single. Day.

Previously

forked from <a href='http://bl.ocks.org/cmgiven/'>cmgiven</a>'s block: <a href='http://bl.ocks.org/cmgiven/d39ec773c4f063a463137748097ff52f'>Zoomable Choropleth</a>

forked from <a href='http://bl.ocks.org/pmia2/'>pmia2</a>'s block: <a href='http://bl.ocks.org/pmia2/4b37a90a24d1004c14c8e9ceae826342'>Zoomable Choropleth</a>

mit Licensed

Similar vizzes