Skip to content

An interactive presidential, senatorial, house, and governor election map for future projections and past results. Written in HTML/CSS/JS

Notifications You must be signed in to change notification settings

jacksonjude/USA-Election-Map

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

USA Election Map

An interactive USA presidential, senatorial, house, and governor election map. Created with HTML/CSS/JS, map svg outlines from YAPms, and map data from MIT Election Lab & Dave Leip's Atlas.

Features

  • Interactive and detailed map sources
  • Comparisons between different map sources
    • Can be used to show shift between elections
    • Can be used to show margins of error between projections and election results
  • Countdown timer to upcoming elections and important events
  • Keyboard controls for advanced usage

Development

Running a fork locally is simple since this code only uses the base HTML/CSS/JS stack. Just clone the repo and open index.html to run.

Since the site uses separate svg files for the map, Chrome and Safari might prevent them from loading over the file protocol due to CORS restrictions (this is a well known issue: see more info and solution).

  • Fixing this CORS issue on Safari is fairly simple: go to Develop > Disable Cross-Origin Restrictions.
  • Chrome is a little more complicated, as it needs to be opened via command line to disable CORS:
    • Mac:
      "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --allow-file-access-from-files
      
    • Windows:
      "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --allow-file-access-from-files
      
  • Alternatively, Firefox can be used without issue since it does not enforce CORS restrictions over the file protocol in the same way.

Another way to address the CORS issue is to run a local http server. On Mac (via Homebrew):

brew install http-server
cd <local repo path>
http-server

Then open the address provided in the Terminal window (by default, it seems to be http://localhost:8080).

TODO List

This is an outdated list. See the project issue board for upcoming features.

  • Past senate election results & 2022 senate projections
    • More past senate election results (1960-1974)
  • More past election results
    • 1960-1972 presidential elections
    • 1912-1956 presidential elections
    • 1856-1908 presidential elections
    • 1788-1856 presidential elections
  • Past governor elections & 2022 governor projections (1980-2020)
  • Full third-party support in past results and custom maps
    • Display in voteshare
    • Display on pie chart
    • Display in past result maps
    • Add & Edit parties in custom map
    • Shift & compare modes for multiple parties
  • Custom map improvements
    • Directly editable margins
    • Direct electoral vote editing
    • Set map-wide electoral votes from decade
  • National popular vote totals for past elections
  • Past house election results
  • Presidential election results by county

If you have any questions, suggestions, or feature ideas, feel free to open an issue here on GitHub. Alternatively, you can email jjcooley0@gmail.com.

About

An interactive presidential, senatorial, house, and governor election map for future projections and past results. Written in HTML/CSS/JS

Topics

Resources

Stars

Watchers

Forks

Sponsor this project