US Elections

Nov 15, 2016

This seems to be the post thruth year, a new word very often in the public eye since Trumps wins. All the things related to all those fake news, etc.

An this is what Miguel Riaño's article is about. In the context of US Elections I was around with US maps and It seems a good chance to publish a county level one.

Before that I made a states level map showing the las five us elections. It features a stacked bar with the results with the candidates faces (a little old-fashioned I know) and some buttons to navigate between them.


An old-fashioned interactive map with the last six General Elections.

Both maps are made in svg with d3js and TopoJSON in svg. Maybe It wasn't a good idea as svg is pretty slow on firefox when you have thousands of svg paths. The issue is in the hover effect on each county path. I used a method to clone that node and put it above, but seems its a cost way to do that.

After the release of this map I was testing the use of a canvas basemap where a svg path appears to create the hover effect. Check it on blocks!.

To map the electoral results to each county I use the TopoJSON CLI. I did something similar in this block. You just need an ID's to match between them.

The maps are deployed as plain javascript using d3 and implemented in a responsive iFrame using npr's pymjs.

The link to the project is broken so I reproduce the code below.

D3.js TopoJSON TopoJSON CLI Pym.js

Candidato Votos Pct