US Electoral Map Maker

From Computernewb Wiki
Jump to navigation Jump to search

The United States Electoral Map Maker is a tool designed for creating political forecasts for the United States Presidential Election, as well as Senate, Governor, and House of Representatives elections. It was written in JavaScript as a personal project to learn Raphael. It is a clone of the website 270ToWin.

How to use

Click on any state to award said state to a candidate. Click once to award the state to a Democratic candidate, and click a second time to award the state to a Republican candidate. The candidate who obtains the 270 electoral votes wins.


In the script.js some settings are present.

  • id: ID of a state, usually represented by the ISO code of said state
  • winner: Determines the winner of the state. 0 = None, 1 = Democrat, 2 = Republican
  • value: How many electoral votes a win a state awards. (Since Senators, Governors and House of Representatives are elected by popular vote rather than the Electoral College, these will instead award 1 seat instead of an electoral vote.)
  • color: Sets the color of the state labels. (Currently, every state except for Hawaii has this value set to #FFF).
  • fill: Sets the fill of the state labels. (Currently, every state except for Hawaii has this value set to #FFF).
  • select: Determines if the state is clickable or not. If this is set to anything other than "yes", then the state will turn black, instead of gray, and it will be unclickable (nothing will happen when you click on it).