New electoral vote calculator (user search)
       |           

Welcome, Guest. Please login or register.
Did you miss your activation email?
April 26, 2024, 09:08:33 PM
News: Election Simulator 2.0 Released. Senate/Gubernatorial maps, proportional electoral votes, and more - Read more

  Talk Elections
  Forum Community
  Forum Community (Moderators: The Dowager Mod, YE, KoopaDaQuick 🇵🇸)
  New electoral vote calculator (search mode)
Pages: [1] 2
Author Topic: New electoral vote calculator  (Read 43873 times)
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« on: November 26, 2020, 10:07:29 AM »
« edited: July 08, 2021, 09:22:41 AM by Virginiá »

As part of an effort to modernize some parts of this forum, I've redone the EV calculator completely. You can check it out here:

https://talkelections.org/FORUM/index.php?action=evcalc

Some notable changes:

  • Clickable map allows toggling party control without using radio buttons
  • Ability to insert custom text for each state's tooltip
  • Can easily change electoral votes
  • Set custom candidates and parties
  • Has EV progress bars that can be embedded with map
  • Party/candidate legend
  • "Prediction mode" with "flipped" status - standardizes prediction shades for use on forum
  • Crisper map graphics
  • Edit other people's map by hovering cursor over maps embedded in post and clicking edit link

Special thanks to Solid for help with pre-CW Virginia coordinates, and Bacon King for a ton of data entry and other help.

-

I've done extensive testing so far, but there might still be some bugs, so if you notice anything, please let me know.

This will just be the first version of this map generator. I'm already working on expanding to state-level maps and senate prediction maps, and maybe more into the future, a congressional map.

- vi
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #1 on: November 26, 2020, 01:58:59 PM »

Thumbs up! Great work, as usual, Virginia. I actually consider using blue for Democrats now.

Maybe a random thought: An additional field to fill in the national popular vote percentage?

You could input it yourself - click on one of the states on the list. The actual name. It'll expand a set of options where you can add tooltip text that shows when a user hovers over a state/district on the map. You can also change the # of electoral votes assigned to that state.
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #2 on: November 26, 2020, 02:07:52 PM »

Technically, the ISO 3166-2 standard state name abbreviations for Wisconsin and West Virginia are WI and WV, respectively. That means when sorting them alphabetically, WV goes after WI. Maybe sometime in the future I'll re-do how the lists are sorted, but right now it's more work than it is worth.

I think PA should put to D>40% instead since Biden didn't pass 50% here.

By the way the new format look great!

I thought he did? Wikipedia has him at 50.01% and NYT at 50.0%
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #3 on: November 26, 2020, 02:22:58 PM »

Nice work!! It's going to be fun converting all my old maps.

You're using the old MS flag, although I assume that it hasn't officially changed yet.

As for PA I was told the State SoS site has the latest numbers and that Biden has majority, barely.

Yeah, I was just waiting on that. I also need an icon of the new flag that is the same size as the others.
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #4 on: November 26, 2020, 08:09:27 PM »
« Edited: November 26, 2020, 08:30:31 PM by Virginiá »

Is 99 the limit it shows on the map for a individual states electoral votes?

For now, anyway. The more space the numbers take up, the more the text placement coordinates have to be adjusted, and right now it's just statically placed with some very rudimentary repositioning for bigger/smaller numbers. If I wanted it to support 100+ while still looking good, I'd need to come up with something better.

On top of that, I don't know what to do about the small states that have result boxes or NH/VT, where long numbers would simply not fit. I opted to restrict it rather than delay release even more.
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #5 on: November 26, 2020, 09:34:42 PM »

How does one access the old maps?

Clicking in the states doesn't appear to go into more detail with counties AFAIK, let alone the other goodies.

I wanted to enable interactive tooltips and have a link to the state results like the old calculator has, but for some reason, the tooltip plugin I use bugs out when I enable interactive mode and it won't show the tips... So until I figure out what the issue is, I'm unable to link to the Atlas state results page without replacing the click-to-change feature I enabled for the map.

I'll keep looking for a solution, though.
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #6 on: November 27, 2020, 09:24:42 AM »

I can't reproduce any missing labels due to zoom.

Replacing EVs as text on the map itself is complicated because the evs supplied in the bbcode data are used for other things, such as the EVBar. It's not just text to be placed into a label. So I would have to come up with a new option for inserting text in lieu of EVs. It'll take some time.

For >99 EVs, I'd have to re-position all the initial state EVs. Thinking about it more, I set the original coordinates based on EVs from 2016's map, which means I can't just assume the base alignment is for a single digit number and expand leftwards as needed, which would make larger EV counts trivial. I'll have to redo all of this.
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #7 on: November 27, 2020, 10:15:34 AM »

I totally forgot to enable something I disabled when testing.

You can copy a person's map and load it into the editor by hovering over the map. You'll see a couple elements pop up at the bottom of the map, including a link labeled "Edit this map" on the bottom right:




Note that this doesn't work as well if you're trying to load a map by another user that was edited manually, as little hacks may work with the map itself fine but the editor is more strict.
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #8 on: November 27, 2020, 11:09:07 AM »

So it looks like there currently is a kludge for Jim's desire to have nothing showup in certain States.

I'm working on some ideas for showing text instead of EVs, but it's less thorough than I like. For example I can interpret the EV value in the region array by type, and use it as an EV if it's an integer, and use it as a text label if it's a string. My hangup is that it's totally not the way I'd do this if I were including that feature from the start. The way I would normally do it is to allow BOTH evs and label text, so the EVs would at least show up in the EVBar and tooltips. I probably should have made the region entry an object, not an array, so I could structure it better.

I'll continue mulling it over.
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #9 on: November 27, 2020, 11:26:59 AM »

Also, unsure of how to handle custom ev label text in the result boxes (MD, CT, DE, etc...). There is nowhere near enough room for any custom text. Might need to restrict text for those states. There isn't enough space to put the text to the right of the box without widening the entire SVG canvas.
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #10 on: November 27, 2020, 12:32:14 PM »

Is there a way to turn off the tool tips?

Yes, an undocumented option:

"useTooltips":false

Add it into the options:{} object, like the other options (if you don't insert it correctly, map will likely error instead of displaying).
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #11 on: November 27, 2020, 10:21:57 PM »
« Edited: November 27, 2020, 10:31:34 PM by Virginiá »

Note that any color of "5" or higher gives black at any level of saturation. Nothing brings about white, which I find interesting on overlaps between elections, as in my favorite (Eisenhower against Obama, which seems to suggest that Ike and Obama ended up with similar constituencies)

You're inputting raw data wrong.

The format is:

Code:
"stateID":[electoral_votes, winningPartyID, popular_vote_shade, "status_string", "tooltip_text"]

winningPartyID is based on the candidates:{} entries. 99 is a static ID used for tossup status. Status string can be 'seceded' or 'territory' or 'removed' for now.

Once I finish working on jimrtex's request, there will be 6th array entry at the end for EV label text.
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #12 on: November 29, 2020, 02:57:23 PM »

I really don't like this updated design at all. It just doesn't work with the Atlas colors. I feel like the modteam or whomever is making these changes should poll the userbase before making "improvements." The same thing happened when the name and board icons of the site were changed, and when the recommend button was added.

I agree. It seems odd that such major changes are suddenly made permanent without any prior consultation.

I did poll the community on recommendations before. It was split. So I eventually went with it. It's a very common forum feature these days, so I don't really get the big deal.

Dave also just released features and took some minor feedback afterwards. I'm unsure why the expectation is changing for things I'm doing. I've also polled the community on other minor changes before, and what I learned was that the vast majority of people here didn't give a crap, so I stopped doing it.

I didn't change the base color designations for the parties, I simply allowed people to fully customize the candidates/parties/colors. As you can see, the colors start the same as Dave's - red for Democrats, blue for Republicans.

If you don't like the shades, you can use the old calculator.

I know some people think it’s an overdue change, but I think it’s a shame that this new EVC seems to be causing the increasing abandonment of the distinctive Atlas colours for the mainstream media ones.

If people don't want to do the old colors, then they aren't going to do it. One reason I started working on this in the first place was that I was noticing more and more people using other map generators and just posting images of their maps. This isn't like the 2000s or early 2010s. There are many options available for this now. I'm not going to purposefully hold things back just to enforce an alternate color scheme. I don't blame people, either. The previous map calculator produces maps that just look very 1990s. I mean, this entire forum is literally using code and a theme designed in the early 2000s. Like it or not, things have to change eventually. At a certain point, it requires more work to keep them the same than it does to evolve and adapt.

At any rate, if people don't like this, I expect them to not use it. I never expected everyone to like it. I know better than that. This forum and the world in general is full of people who like specific things, and that's that, come hell or high water.
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #13 on: November 29, 2020, 03:00:12 PM »

re: NE/ME electoral votes - I'll fix later tonight or tomorrow morning.
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #14 on: November 30, 2020, 09:30:51 PM »

Just one thing, I think the colors for Lean are too dark. The tilt colors are more what I imagine for leaning states, and tilt should be even lighter than that

Amazing work!

I agree - I've changed the shading to reflect it better.

One thing I did notice was that the default rankings when you load an election do not properly reflect reality, but this is because I don't have the exact election results to work with. The data sets it uses are no more detailed then the calculator page (30%, 40%, 50%, etc), so I can't tell if a state was won by 51% or 59%. So it is really up to the user to fill out the prediction map.

At some point I might try to code a script to crawl Wikipedia to get the exact percentages, or maybe see if Dave would collaborate on it.

Notice something wrong with NE and ME?

I fixed the issue, but unfortunately, due to the nature of the problem, only new maps from this point on will not have the problem. It was an issue with how the bbcode data was built, not displayed.
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #15 on: November 30, 2020, 09:45:08 PM »

What is the fourth field for each State?

It's actually for the EV text label you've asked for, but I'm not finished with it. I just realized I included parts of that unfinished code in this update and removed it.

I've mostly finished the label code but I need to rebuild the position coordinates for each label on the canvas before I can push that update. Will take more time.
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #16 on: December 05, 2020, 04:01:55 PM »

The shades are not something I really want to change - at least changing back to the original colors. Regarding consistency with the main Atlas site - I get that it's not consistent, but we aren't the same entity anymore. I don't really want to tie this forum to Dave's site so intricately as to even share the same color shades, at least when I'm not particularly fond of it, anyway.
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #17 on: December 05, 2020, 09:48:42 PM »

The new calculator is a huge improvement. I did notice a few errors, however. It would be great if you could turn off the split electoral votes in ME/NE.

Toggle "Display results by congressional district on map"

Split EVs are completely optional, they are just enabled by default depending on how the state currently allocates electoral votes.

Also, the states aren't quite in alphabetical order which is slightly annoying.

Fixing it is more annoying than what the outcome is worth, for the time being.
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #18 on: December 12, 2020, 10:11:56 PM »
« Edited: December 12, 2020, 10:17:08 PM by Virginiá »

Meant to do just a small feature update for adding custom labels but somehow have gotten roped into much more in trying to add pre-1840 elections. I think I see why Dave didn't do those years. It's a lot of work to actually get it right. Electoral votes in that time period start getting assigned in all sorts of ways the further you go back, with the common thread being that the winner of the state does not always get all the EVs. So now I'm basically adding faithless electoral vote support way ahead of schedule so as to support pre-1840 maps.

On a side note, would anyone be interested in extending the territory maps on Wikipedia? It's SVG format, and most of the territories are done, but as you can see in pre-1840 maps, since the states are all on the eastern US, the original map authors didn't draw the full territories (they just cut off arbitrarily). I'd like to incorporate these territories at some point, but I would need the full territory paths across the entire US, and not just portions of them, making sure to properly label each territory in the element attribute(s).

If you're interested, the easist way to contribute would be to just complete the maps on Wikipedia for elections prior to 1844. The goal would be something like this.
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #19 on: January 01, 2021, 04:01:11 PM »

What is the objective?

Do you (Virginia) want maps with the modern territorial extent of the United States? Should such maps include PR, VI, GU, AS, and MP? In this case there could be an inset map of PR and VI in the Gulf of Mexico or on top of the Bahamas, along with a box for VI, and boxes for MP, GU, and AS.

Just a basic recreation of the state and territory map of the continental US. Adding places like VI/GU/etc is a bit much for the scope of this project.

To reduce data size, it would be preferable to have as few territorial changes as possible while still reflecting the general lay of the land. In other words, if there were minor changes to a territory between two elections, it doesn't necessarily have to be implemented.

It might be easier to recreate the original map, rather than rely on the Wikipedia version (or obtain the underlying map for the Wikipedia map). I'm assuming that if I were to create a .svg map showing the modern territorial extent for the USA for the 1788/9 election, that my edit would be countermanded by someone who preferred the contemporary extent.

Thinking about it more, probably - yes. Posting the map here would be fine then too.

I don't think this effort serves a whole lot of purpose other than filling out the map generator for aesthetics. I think it's probably rare that users even use those presidential years for their maps. Nevertheless, it would be nice to have, so if anyone is ever bored and wants to do it, I'll integrate it so long as it fits the exact boundaries/specs of the map currently in use by the calculator (in other words, I need to be able to just add the territory paths to the paths array and have it just 'fit' into the map without adjusting other regions).
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #20 on: January 01, 2021, 04:01:54 PM »

I'll adjust the winning percentages when I do the next update. Just been busy lately, and rather unmotivated when I do have some free time for this.
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #21 on: January 17, 2021, 04:01:24 PM »

Right, so it looks like for the existing SVG data the map generator uses, Georgia would just need to be merged with AL/MS, NC merged with TN, and VA merged with WV/KY.

What I meant by the paths array is that most if not all of the regions on the map are implemented via a <path> html element, so each region has to essentially be 1 path element.
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #22 on: January 23, 2021, 08:41:03 PM »

I’ve noticed many people using the new maps while using the old colors.

I think it’s best to be uniform.

The old color scheme should be phased out. You have to be a Atlas regular to really get why some things are backwards. It’s common knowledge now Blue is Dem, Red is GOP.

I made a big effort to make everything customizable so the forum could chart its own path. If people want to continue using the Atlas color scheme, they should do that. It's not up to me to decide how people style their maps.
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #23 on: January 29, 2021, 08:52:49 PM »

The name O'Rourke breaks the calculator.

I tested that name, it didn't seem to break anything. What did it do on your end?
Logged
Virginiá
Virginia
Administratrix
Atlas Icon
*****
Posts: 18,892
Ukraine


Political Matrix
E: -6.97, S: -5.91

WWW
« Reply #24 on: February 28, 2021, 04:01:08 PM »

I have it included in the next update. Hopefully I can get that done this week, or maybe tomorrow sometime.

I meant to get that done a while ago but I tried to add faithless elector support which ended up necessitating huge changes, and right as I was again losing interest in coding again, so I had scale back my ambitions and take a break from forum-related projects.
Logged
Pages: [1] 2  
Jump to:  


Login with username, password and session length

Terms of Service - DMCA Agent and Policy - Privacy Policy and Cookies

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Page created in 0.05 seconds with 13 queries.