This module allows users to view the results of the elections that put each state’s incumbent governor in office.
This module lives in lib/map_center/modules/governors.js.
Note
This currently only includes data from Wisconsin due to deadline pressures involved with that state’s recall election. The other states will be added later.
Todo
Add support for viewing a nationwide state map with incumbent governors’ party affiliations and support for clicking a state to view that state’s election results.
The one tab available in this module allows users to select a state in order to view the county-level results of the most recent election that elected that state’s incumbent governor (i.e., not including recall efforts that governor survived).
The sidebar in this module shows the statewide vote breakdown in the race, and the tooltips for each county shows the countywide vote breakdown in the race.
All configuration options live in the config object toward the top of the module source and may be overridden by defining a global object named nhmcGovernorsConfig, which will be merged into config using jQuery.extend.
The data driving this module is located in an object called resultsData toward the top of the module source. It has capitalized state abbreviations as found in nhmc.config.USPSToState as keys and objects as values. In each state’s object:
areas is an object with county FIPS codes as keys and arrays as values. Each array contains one two-element array per candidate: The first element is the candidate ID listed in candidates, and the second element is the number of votes that candidate received. The county’s array is sorted by the number of votes received in descending order; that is, the candidate with the most votes in that county is listed first.
breakdown is an array identical in format to the county arrays in areas but with results for the entire state.
candidates is an object with candidate IDs as keys and candidate names as values. This allows the data in areas, breakdown and parties to use the more compact candidate IDs instead of candidate names to save space.
Note
All configuration options use candidates’ names, not their IDs. IDs should not be used with any other modules; they are arbitrarily assigned to candidates.
electionYear is a string with the year the election described took place.
parties is an object with candidate IDs as keys and party abbreviation letters (corresponding to the keys in config.partyColors) as values.
This module makes use of one key-value pair in the fragment identifier via nhmc.ctrl.hashParams: