Election Calculator / Simulator 2.0 released

(1/11) > >>

Virginiá:
After many months of squeezing in an hour or two of work here and there, I've finally got the next major release of the election simulator ready. I've expanded the functionality quite a bit, including to Senate/Gubernatorial elections. Here is the (almost) full list of features, enhancements and bug fixes:

Use on this page:
https://talkelections.org/FORUM/index.php?action=evcalc


New features
----------------------------------------------------------------------------------------------------
Senate/gubernatorial maps (Senate maps can have special elections added/removed at will)Faithless electors / divided electoral vote support (mostly for pre-1836 elections)pre-1836 presidential result mapsLarge map support (for editor page only)Many territories now shown on historical maps (still lots more to do though!)States can now be sorted on the map editor page's state list. Sort by geographical region or Cook Partisan Voting Index (2016-2020)Maps now have a custom right-click menu. This will allow another quick way to change region status/winner/shading in the map editor.Added preset map themes (Default or Bold)Ability to load legacy (Dave's calculator) maps in new editor - old maps displayed in forums posts have option to be loaded in new editor when hovering over with mouse, and you can paste the [img] map links into input on editor page by clicking "Load Legacy Map In Editor" near the bottom to load old map in the new simulatorMaps can now have a custom image embedded either in the background or foreground, and can also have their transparency toggledEditor now remembers and loads the map you were last working on. This is tied to your forum session, and will eventually be lost after a couple weeks. Editor will also remember the collapsed state of individual sections.



Enhancements
----------------------------------------------------------------------------------------------------
Electoral vote bar recoded entirely to sort based on highest and 2nd highest vote winner, also in SVG formatUnpledged/non-voting electors shown in electoral vote barAdded 'ineligible' status for states that were not eligible to vote in time for the 1789 presidential electionImproved map shadow optionAll maps should now have detailed electoral vote allocations shown (please notify me if any are missing/inaccurate)Regions that did not hold a popular vote now use a darker shade so maps are easier to interpret (40 pop vote shade).States with missing popular vote data now display a hatching pattern indicating data is missingRegions can now have the flipped status and a no popular vote held status on any presidential map typeOption to hide container borders for party legendMaps now have more options for customization (dark borders, thicker borders, show territories, etc)Custom vote/region label text is now centered betterRegion tooltips now better display longer candidate namesvote-by-district parent region (ME, NE) can now have their electoral votes modified (it will be reset though if you toggle vote-by-cd on/off)Electoral votes can now be reset to original values on an individual basisCongressional district options are now merged into main state table list to save vertical space on calculator pageHighlighted region borders on mouse hover now looks less choppy



Bug fixes
----------------------------------------------------------------------------------------------------
Vote-by-district entries now have their EV text shown as black under same conditions as statesFixed Tossup evbar showing tooltip with prediction rating slots (should be nothing but # of regions that are tossup)Electoral vote left-hand clipping issue mitigatedFixed issue where changing electoral votes for a region would overwrite custom label text on calculator pageCongressional district tooltips on presidential map now correctly show state flagRegion tooltips screwed up when set to TossupMitigated a bug where hovering over large parts of New Hampshire would cause Vermont's tooltip to be shown and borders to be highlightedFixed wrong electoral vote count for AR and LA in 1872 mapFixed bug where Maine electoral votes could not be changed even when vote-by-CD mode was disabledFixed bug where elections with a lot of defined candidates/independents could have the same color used for multiple candidatesMap embed data now has smaller memory footprint for most mapsCorrected a few election data errors (wrong candidate names/parties - thanks to Truman for pointing it out)Fixed a bug where seceded states in an 1864 map, or other maps with ineligible states would have their region color changed if pop vote shading was toggledFixed a bug where maps with unicode characters (eg: Cyrillic, Chinese, etc) for names/tooltips/labels/etc would cause the map to fail to load Alternative fix required - will update when foundFixed a bug where resetting all regions to TOSSUP would cause map to forget other regional settings


Previous release threads
----------------------------------------------------------------------------------------------------

Version 1

Virginiá:
Examples of new map features:

Senate (2018) map with new, optional Bold theme:


function evmap_create_297135315762987931857(btne){new EVMap({"version":"1.1","race":"senate","format":"results","baseYear":2018,"rid":"","numCandidates":2,"regionData":{"AK":[2,1,0,"noelection"],"AL":[2,{"ow":0,"vd":[[0,1],[1,1]]},0,"noelection"],"AR":[2,1,0,"noelection"],"AZ":[2,{"ow":0,"vd":[[0,1],[1,1]]},50,"flipped"],"CA":[2,0,50],"CO":[2,{"ow":0,"vd":[[0,1],[1,1]]},0,"noelection"],"CT":[2,0,50],"DE":[2,0,60],"FL":[2,1,50],"GA":[2,1,50,"noelection"],"HI":[2,0,70],"IA":[2,1,0,"noelection"],"ID":[2,1,0,"noelection"],"IL":[2,0,50,"noelection"],"IN":[2,1,50,"flipped"],"KS":[2,1,0,"noelection"],"KY":[2,1,0,"noelection"],"LA":[2,1,0,"noelection"],"MA":[2,0,60],"MD":[2,0,60],"ME":[2,{"ow":0,"vd":[[0,1],[1,1]]},50],"MI":[2,0,50],"MN":[1,0,60],"MN1":[1,0,50],"MO":[2,1,50,"flipped"],"MS":[1,1,50],"MS1":[1,1,50],"MT":[2,{"ow":0,"vd":[[0,1],[1,1]]},50],"NC":[2,1,0,"noelection"],"ND":[2,1,50,"flipped"],"NE":[2,1,50],"NH":[2,0,0,"noelection"],"NJ":[2,0,50],"NM":[2,0,50],"NV":[2,0,50,"flipped"],"NY":[2,0,60],"OH":[2,{"ow":0,"vd":[[0,1],[1,1]]},50],"OK":[2,1,0,"noelection"],"OR":[2,0,0,"noelection"],"PA":[2,{"ow":0,"vd":[[0,1],[1,1]]},50],"RI":[2,0,60],"SC":[2,1,0,"noelection"],"SD":[2,1,0,"noelection"],"TN":[2,1,50],"TX":[2,1,50],"UT":[2,1,60],"VA":[2,0,50],"VT":[2,0,60,"noelection"],"WA":[2,0,50],"WI":[2,{"ow":0,"vd":[[0,1],[1,1]]},50],"WV":[2,{"ow":0,"vd":[[0,1],[1,1]]},40],"WY":[2,1,60]},"candidates":[["","Democratic","Democratic Party","r","",false],["","Republican","Republican Party","b","",true]],"options":{"showShadow":true,"showThickBorders":true,"showBlackBorders":true,"showResultsByCD":false,"useStateNameForLabels":true,"defRegionStatus":"noelection","calculatorLink":"https:\/\/talkelections.org\/FORUM\/index.php?action=evcalc"}}).createMap(btne);}if ( typeof _isInNestedQuote === "function" && _isInNestedQuote() ) {let smb = document.createElement("div");smb.style='display: inline-block;';smb.innerHTML = 'Show map';document.scripts[document.scripts.length - 1].parentNode.appendChild(smb);}else evmap_create_297135315762987931857();



Faithless / proportional electoral votes:


function evmap_create_28395320655437158098795(btne){new EVMap({"version":"1.1","race":"president","format":"results","baseYear":1824,"rid":"","numCandidates":4,"regionData":{"AL":[5,0,60],"CT":[8,1,70],"DE":[3,{"ow":2,"vd":[[2,2],[1,1],[0,0],[3,0]]},0],"GA":[9,2,0],"IL":[3,{"ow":0,"vd":[[0,2],[1,1],[2,0],[3,0]]},30],"IN":[5,0,40],"KY":[14,3,70],"LA":[5,{"ow":0,"vd":[[0,3],[1,2],[2,0],[3,0]]},0],"MA":[15,1,70],"MD":[11,{"ow":0,"vd":[[0,7],[1,3],[2,1],[3,0]]},50],"ME":[9,1,80],"MO":[3,3,50],"MS":[3,0,60],"NC":[15,0,50],"NH":[8,1,90],"NJ":[8,0,50],"NY":[36,{"ow":1,"vd":[[1,26],[2,5],[3,4],[0,1]]},0],"OH":[16,3,50],"PA":[28,0,70],"RI":[4,1,90],"SC":[11,0,0],"TN":[11,0,90],"VA":[24,2,50],"VT":[7,1,0]},"candidates":[["","Democratic-Republican","Democratic-Republican Party","b","Andrew Jackson",false],["","Democratic-Republican","Democratic-Republican Party","r","John Quincy Adams",false],["","Democratic-Republican","Democratic-Republican Party","g","William H. Crawford",false],["","Democratic-Republican","Democratic-Republican Party","y","Henry Clay",false]],"options":{"legendUseCandidateName":true,"defRegionStatus":"unknown","calculatorLink":"https:\/\/talkelections.org\/FORUM\/index.php?action=evcalc"}}).createMap(btne);}if ( typeof _isInNestedQuote === "function" && _isInNestedQuote() ) {let smb = document.createElement("div");smb.style='display: inline-block;';smb.innerHTML = 'Show map';document.scripts[document.scripts.length - 1].parentNode.appendChild(smb);}else evmap_create_28395320655437158098795();



Custom overlay image with 50% transparency (Jeb over 2020 Senate map):


function evmap_create_54969153565026076346076(btne){new EVMap({"version":"1.1","race":"senate","format":"results","baseYear":2020,"rid":"","numCandidates":2,"regionData":{"AK":[2,1,50],"AL":[2,1,60,"flipped"],"AR":[2,1,60],"AZ":[2,0,50,"flipped"],"CA":[2,0,0,"noelection"],"CO":[2,0,50,"flipped"],"CT":[2,0,0,"noelection"],"DE":[2,0,50],"FL":[2,1,0,"noelection"],"GA":[1,0,50,"flipped"],"GA1":[1,0,50,"flipped"],"HI":[2,0,0,"noelection"],"IA":[2,1,50],"ID":[2,1,60],"IL":[2,0,50],"IN":[2,1,0,"noelection"],"KS":[2,1,50],"KY":[2,1,50],"LA":[2,1,50],"MA":[2,0,60],"MD":[2,0,0,"noelection"],"ME":[2,{"ow":1,"vd":[[0,1],[1,1]]},50],"MI":[2,0,40],"MN":[2,0,40],"MO":[2,1,0,"noelection"],"MS":[2,1,50],"MT":[2,{"ow":1,"vd":[[0,1],[1,1]]},50],"NC":[2,1,40],"ND":[2,1,0,"noelection"],"NE":[2,1,60],"NH":[2,0,50],"NJ":[2,0,50],"NM":[2,0,50],"NV":[2,0,0,"noelection"],"NY":[2,0,0,"noelection"],"OH":[2,{"ow":0,"vd":[[0,1],[1,1]]},0,"noelection"],"OK":[2,1,60],"OR":[2,0,50],"PA":[2,{"ow":0,"vd":[[0,1],[1,1]]},0,"noelection"],"RI":[2,0,60],"SC":[2,1,50],"SD":[2,1,60],"TN":[2,1,60],"TX":[2,1,50],"UT":[2,1,0,"noelection"],"VA":[2,0,50],"VT":[2,0,0,"noelection"],"WA":[2,0,50],"WI":[2,{"ow":0,"vd":[[0,1],[1,1]]},0,"noelection"],"WV":[2,{"ow":1,"vd":[[0,1],[1,1]]},70],"WY":[2,1,70]},"candidates":[["","Democratic","Democratic Party","r","",false],["","Republican","Republican Party","b","",true]],"options":{"showShadow":true,"showThickBorders":true,"showBlackBorders":true,"showResultsByCD":false,"useStateNameForLabels":true,"defRegionStatus":"noelection","image":{"url":"jeb","x":"","y":"","width":"","height":"","opacity":"50%","background":false},"calculatorLink":"https:\/\/talkelections.org\/FORUM\/index.php?action=evcalc"}}).createMap(btne);}if ( typeof _isInNestedQuote === "function" && _isInNestedQuote() ) {let smb = document.createElement("div");smb.style='display: inline-block;';smb.innerHTML = 'Show map';document.scripts[document.scripts.length - 1].parentNode.appendChild(smb);}else evmap_create_54969153565026076346076();

Virginiá:
I've also got the state maps getting closer to release. I still need at least one recent election's worth of data to provide a base set of maps though. Not sure how to put that together myself.

Technically, if you wanted to make a state map, you could, but I won't guarantee that old maps won't break when I finally release the actual state-level map generators. Quote/view post [ map ] bbcode to see how:

test:


function evmap_create_51032352042850003009935(btne){new EVMap({"version":"1.0","race":"president","map":"state","rid":"AK","format":"results","origin":{"id":0,"oa":0,"ea":0},"baseYear":2020,"regionData":[[3,1,50],[9,1,60],[6,1,60],[11,0,40],[55,0,60],[9,0,50],[7,0,50],[3,0,90],[3,0,50],[29,1,50],[16,0,40],[4,0,60],[6,1,50],[4,1,60],[20,0,50],[11,1,50],[6,1,50],[8,1,60],[8,1,50],[11,0,60],[10,0,60],[16,0,50],[10,0,50],[10,1,50],[6,1,50],[3,1,50],[15,1,40],[3,1,60],[4,0,50],[14,0,50],[5,0,50],[6,0,50]],"candidates":{"0":["dem","Democratic","Democratic Party","r","Beto O'Cruz",false],"1":["rep","Republican","Republican Party","b","Ted O'Rourke",true],"2":["ind","Libertarian","Libertarian Party","y","Jo Jorgensen",false],"3":["ind2","Green","Green Party","g","Howie Hawkins",false],"4":["ind","Independent","Independent","p","Generic Candidate",false],"5":["ind2","Independent","Independent","o","Generic Candidate",false],"99":["tossup","Tossup","Tossup","gr","",false]},"options":{"showEVBar":true,"showLegend":true,"legendUseCandidateName":true,"showElectoralVotes":true,"showResultsByCD":true,"showPopularVoteShading":true,"showShadow":false,"showResultBoxSideText":true,"useBlackText":false,"numIndependents":0,"defRegionStatus":"territory","calculatorLink":"https:\/\/talkelections.org\/FORUM\/index.php?action=evcalc"}}).createMap(btne);}if ( typeof _isInNestedQuote === "function" && _isInNestedQuote() ) {let smb = document.createElement("div");smb.style='display: inline-block;';smb.innerHTML = 'Show map';document.scripts[document.scripts.length - 1].parentNode.appendChild(smb);}else evmap_create_51032352042850003009935();


-


Regarding custom image overlays, if anyone thinks there should be a preset image I should upload so people can easily use it on maps, let me know. I only added "jeb" for now. (If you type "jeb" without quotes into the Custom Image URL field on the map generator page, you'll get jeb on the map).

President Johnson:
Great work, Virginia. Thanks for all the efforts you're putting in this.

A small note on something I realized: It seems that certain browser features such as a blocker for cookie banners indeed block the map from being displayed or even the forum link to be generated (that wasn't the case before). I only use the add-on "I don't care about cookies" because EU laws require all European websites to ask for allowing cookies with annoying banners popping up on almost every website. Now that I deactivated the feature for Talk Elections (not that I would need here anyway), it just works fine. So if anything, it might be more of an issue for European users.

CentristRepublican:
Quote from: President Johnson on January 21, 2022, 02:06:13 PM

Great work, Virginia. Thanks for all the efforts you're putting in this.


Navigation

[0] Message Index

[#] Next page