Template talk:Election results/Archive 1

Latest comment: 8 months ago by Number 57 in topic Fixed widths
Archive 1

Requested upgrades

I have a few requests that would upgrade this template for wider use:

  1. Add the possibility to enter a colour where there is no meta template. Currently if you enter a party name with no colour template attached, the template falls over.
  2. Add the possibility of an 'against all' option, which would not have a party colour, so would span 2-3 columns depending on whether the vice-president paramter was called. The votes for the 'against all' count as valid votes for the purpose of totalling and percentages, so the row should also not be shaded like the valid/invalid vote ones.
  3. Add the possibility of a second round – this would change the heading quite a bit (to look like that of 2020 Polish presidential election#Results. This could perhaps be called if votes1_2 were invoked. In almost all cases only the top two candidates progress to the second round, so the code for blocking out the candidates that didn't progress could be "colspan=2 rowspan=cand minus 2" or something.
  4. Add functionality for parliamentary elections:
    1. For basic use the following two additions are needed:
      1. Addition of a seats parameter, which if called, removes the president and vice-president columns
      2. Addition of a 'Total' row. This would be placed above the valid votes row, but not be shaded. It should sum the valid votes and the seats and have 100 for the percentage total
    2. Additional features that would help initially are:
      1. Seat change column after seats (perhaps using parameter sc The values would be manually entered and not fomatted as numbers. If sc is called, there also needs to be an option to set the value for the total row, as the overall number of seats may increase.
      2. The ability to amend the value of the valid votes for the shaded valid votes row, as in some countries voters may cast multiple votes, meaning the total number of votes cast for parties is much higher than the valid votes cast – see e.g. 2017 Liechtenstein general election#Results.

There are a few other potential features that would be good (variations on two round parliamentary elections and the infamous South American simultaneous vote system where one vote is cast for president and both houses of parliament), but I think the amendments above would probably cover at least 75% of election articles. Number 57 21:07, 18 August 2020 (UTC)

Number 57, okay, item 1 is done. do you have a non-templated example for item 2 (easier if I can code to a target)? item 3 shouldn't be that hard since you have provided a link to how the output should look (will work on that next). if you have more examples for item 4, that would be helpful, or I could just start by getting the 2017 Liechtenstein table working. Frietjes (talk) 21:59, 18 August 2020 (UTC)
@Frietjes: Thanks! Below are some illustrations for the various types of tables that are commonly used (some of the numbers are nonsense, just put in to illustrate the format). It would also be good to have an optional header row similar to the caption one for editors to insert parliamentary diagrams, such as the one shown here. Typically these are included with a pale background rather than the heading one for purposes of contrast. Cheers, Number 57 22:49, 18 August 2020 (UTC)
Also, could there be a switch for the party link not to exist? Some parties may not be notable enough for an article and it would be best to avoid having redlinks. Number 57 22:54, 18 August 2020 (UTC)
And sorry, one more thing before I call it a night – is it possible to remove the percentage signs in the percentage column? They are not typically shown in these columns as the whole set of numbers is known to be a percentage. I didn't know if it can be avoided given that it is an autocalculation? Number 57 22:59, 18 August 2020 (UTC)
I made some progress on the two round case in the sandbox (see the testcases) and removed the percentage signs (see the testcases). Frietjes (talk) 00:08, 19 August 2020 (UTC)

Number 57, there is a lot you are requesting all at once here, so please remind me if I forget about something! I, personally, don't like the autolinking of the candidate names. just like a party may not be notable, the same is true for candidates. so, before deploy this too widely and make too many more changes, how about if we eliminate autolinking entirely. the module can easily parse wikilinks and extract the link target, so getting the meta/color name from a wikilinked party is not a problem. if the party is plain/unlinked text, then the module will use that for checking the for a meta/color template. Frietjes (talk) 00:08, 19 August 2020 (UTC)

Yes, good idea to avoid autolinking. I hadn't actually realised this was the case for candidates until this evening, but forgot to add it to the 'to do' list. Sorry if this is asking a lot... Number 57 00:14, 19 August 2020° (UTC)
BTW, what would happen when you had a party in one country with an article at an undisambiguated title, and one in another by the same name but not notable and without an article. Could you prevent the link/colour being used? Number 57 00:21, 19 August 2020 (UTC)
Number 57, after the most recent changes, the party is only linked if it is explicitly linked. the coloring is extracted from the link target, but you can always override this by using |color1= or |colour1= in which case it skips the meta/color check entirely. you can see my progress thus far in the testcases. I probably won't get to your other examples until Thursday or Friday, but I may find some time before then. so long as we keep a good set of testcases, I can make more changes without breaking any existing uses, so the template/module should be relatively stable at this point. I am pondering if we want to make the syntax for against_all more generic to merge the logic for that case with the syntax for "appointed seats" but I have not tackled that one yet. Frietjes (talk) 19:25, 19 August 2020 (UTC)
@Frietjes: Great work – I saw the linking technique when you edited the Taiwanese articles – it's a really clever bit of coding! It all looks like it's coming together very nicely – it's really appreciated as this could solve a lot of headaches! Number 57 20:35, 19 August 2020 (UTC)
@Frietjes: Do you think the template is in a stable enough state to start rolling it out it for presidential elections? Also, I noticed the parliamentary usage is nearly there - all that appears to be missing for a standard one-round election is the seat change sum. Once this is in place, I'd be happy to start rolling that out too? Number 57 18:58, 22 August 2020 (UTC)
Number 57, I added sums for seats and seat changes, including when there is no |valid=. you should feel free to start using the template so long as there are examples covering all uses in the testscases. I will always check to make sure I don't break any of the test cases before rolling out new features. if I make any input syntax changes, we can track/fix any uses and/or continue to support old syntax. I don't foresee any major syntax changes. I am pondering making |against_all= more generic, but no significant planning yet. Of course, if you see any problems or problematic syntax, let me know so I can make changes. Frietjes (talk) 23:46, 23 August 2020 (UTC)
@Frietjes: Great, I'll start adding it to other articles. One slight issue - the total seat change figure should not autocalculated from what's in the column, as there will be parties that win seats in one election and do not participate in the next, so that loss of seats would not be listed in the table (and so would not be taken into account in the autocalculated figure). Could you make this parameter a manual input? Cheers, Number 57 11:56, 24 August 2020 (UTC)
Also, I agree making 'against_all' generic would be good – in some countries it is referred to as 'None of the above', so would be good to make it editable (plus as you say, it could also be used for the 'Appointed' row). Number 57 12:23, 24 August 2020 (UTC)
Number 57, okay, now updated. if you set |total_seats=TOTAL it auto-calculates the total. if you set |total_seats=100 it uses 100 for the total. if you omit this parameter, it doesn't include a total number of seats. the same for |total_sc=. also, |against_all= and |against_all2= are now deprecated (and will probably be removed). to include any non-candidate and non-party affiliated row, use |rowX= where 'X' is a unique row number (this overrides candX, vpX, and partyX for that row number). let me know if you see any problems with these changes. I probably won't have much time to work on it again until after Thursday, but I may find some time if it's a simple change. Frietjes (talk) 15:55, 24 August 2020 (UTC)
@Frietjes: Thanks – am starting to roll it out and seems to be working fine. If it is a quick change (I have no idea), it would be helpful to have a row that sits above the headers for parliamentary elections to allow diagrams to be added. See e.g. 2016 Kazakh legislative election#Results. Cheers, Number 57 21:19, 24 August 2020 (UTC)
Number 57, |image= works with any raw text, or I can have it piped through Module:InfoboxImage if you want the option to specify just the name image. Frietjes (talk) 22:16, 24 August 2020 (UTC)
@Frietjes: Super, thanks! I think it's best to keep it as raw text, as sometimes two diagrams are inserted (e.g. when there is a Chamber and Senate election together).
Separtely, for parliamentary elections, I think we would always want the total row to appear above the valid/invalid section - I'm not sure having the total seats in the grey section at the bottom really works (particularly as it says "Total votes"). Would it be possible to set it so the total seats rows always appears when the 'seats' function is used, rather than having to force it with 'valid'? I think the 'valid' parameter would be a manual override for the valid row, but not sure it needs to be used when the total votes equals the valid votes (I hope that makes sense?). Cheers, Number 57 21:35, 25 August 2020 (UTC)

Number 57, I think I made the requested change. let me know if I didn't do what you were requesting, or if I need to modify that part further. Frietjes (talk) 22:44, 25 August 2020 (UTC)

@Frietjes: Now if you don't enter a 'valid' figure for a parliamentary election, the shaded valid row is zero (see the 'Without valid and with total' examples in the testcases. I think the valid figure should be the sum of all votes for parties (and against all), unless it is manually overridden by entering |valid=XXXXX Also, the non-shaded total line should always appear when 'seats' is called (this doesn't happen - see the 'Without valid' row). The total number of seats should also always be the same as the total number in the column, so can this default to the total value without |total_seats=TOTAL having to be added? Only the seat change would not necessarily tarry and need to be entered manually each time. Number 57 23:08, 25 August 2020 (UTC)
Number 57, the zero should be fixed and the total seats should always show when there are seats. Frietjes (talk) 23:26, 25 August 2020 (UTC)
@Frietjes: Fantastic, thanks! Number 57 23:37, 25 August 2020 (UTC)

Potential tables

Parliamentary mixed-member system

'Proportional' and 'Constituency' should be manually editable as sometimes it may be 'Chamber' and 'Senate' for countries where a single vote elects both. A ± column may be used or not.

Party Votes % Seats
Proportional Constituency Total ±
Progressive Citizens' Party 68,673 35.2 9 9 18 +1
Patriotic Union 65,742 33.7 8 9 17 –1
The Independents 35,885 18.4 5 0 5 New
Free List 13,233 9.4 3 0 3 0
Total 183,533 100 25 18 43 0
Valid votes 14,768 95.8
Invalid/blank votes 645 4.2
Total 15,413 100
Registered voters/turnout 19,806 77.8
Source: Landtagswahlen
Parliamentary two-round or parallel voting

TEXT1 and TEXT2 should be manually entered as it could refer to first and second round, or it could refer to 'Constituency vote' and 'National vote'. This table would also have to be able to handle non-participation of some parties in one part of the election and could be with or without a seat change column

Party TEXT1 TEXT2 Total
seats
Votes % Seats Votes % Seats
Progressive Citizens' Party 68,673 35.2 9 100,000 50.00 9 18
Patriotic Union 65,742 33.7 8 100,000 50.00 9 17
The Independents 35,885 18.4 5 5
Free List 13,233 9.4 3 3
Total 183,533 100 25 200,000 100 18 43
Valid votes 14,768 95.8 15,000 95.00
Invalid/blank votes 645 4.2 1,000 5.00
Total 15,413 100 16,000 100
Registered voters/turnout 19,806 77.8 20,000 85.00
Source: Landtagswahlen
Double simultaneous vote (uncommon system so not necessary if too complex)

May or may not have a presidential second round

Party Presidential candidate First round Second round Seats
Votes % Votes % Chamber +/– Senate +/–
Broad Front Daniel Martínez 949,376 40.49 1,152,271 49.21 42 –8 13 –2
National Party Luis Alberto Lacalle Pou 696,452 29.70 1,189,313 50.79 30 –2 10 0
Colorado Party Ernesto Talvi 300,177 12.80 13 0 4 0
Open Cabildo Guido Manini Ríos 268,736 11.46 11 New 3 New
Partido Ecologista Radical Intransigente César Vega 33,461 1.43 1 +1 0 0
Party of the Folk Edgardo Novick 26,313 1.12 1 +1 0 0
Independent Party Pablo Mieres 23,580 1.01 1 –2 0 –1
Popular Unity Gonzalo Abella 19,728 0.84 0 –1 0 0
Green Animalist Party Gustavo Salle 19,392 0.83 0 New 0 New
Digital Party Daniel Goldman 6,363 0.27 0 New 0 New
Workers' Party Rafael Fernández 1,387 0.06 0 0 0 0
Total 2,344,965 100 2,341,584 100 99 0 30 0
Valid votes 2,344,965 90.00 2,341,584 90.00
Invalid/blank votes 88,399 10.00 91,612 10.00
Total 2,433,364 100 2,433,196 100
Registered voters/turnout 2,699,978 90.13 2,699,980 90.12
Source: Corte Electoral

Grey font

Thanks for your work on the template. Could the font of the "Valid votes" lines and subsequent ones not be grey shaded, though? It make it harder to read, and I don't really see the point.--Aréat (talk) 21:30, 30 August 2020 (UTC)

The colour separates/differentiates it from the main section of the results. What do you propose instead? Number 57 22:27, 30 August 2020 (UTC)
Is there really a need for that? The tables we've been using so far don't have them. If you really want a separation, there could maybe be just the first total be grey, or a thin empty line after it like there. --Aréat (talk) 22:43, 30 August 2020 (UTC)
I think there is a need to clearly separate it, and shaded rows are used in some articles to do so (although not the ones I tend to edit). If we were to go down the line approach, I think I would prefer a darker colour one like that used in 2017 Liechtenstein general election#Results – I think this helps make the separation clearer. Number 57 11:15, 31 August 2020 (UTC)
I have no strong opinion on the actual color of the line, and I can see the benefits of making a clear separation, so if it can avoid having to read many important numbers on a darker font, I'm all for it! Well, if you're ok with it as well @Frietjes:, of course. I hope it wouldn't be a hassle of a change to implement if so. Cordially. --Aréat (talk) 13:09, 31 August 2020 (UTC)
I managed to insert the line in the sandbox version, but could not turn off the shading for the 'Valid votes' cells... Number 57 13:46, 31 August 2020 (UTC)
@Number 57 and Aréat: I implemented it in the sandbox (need background:inherit for any th cells), see the Template:Election results/testcases. if this looks acceptable, we can copy it over to the main module. Frietjes (talk) 13:56, 31 August 2020 (UTC)
@Frietjes: Thanks! I made the line a slightly lighter colour to match the Liechtenstein version, but otherwise it's great – please do copy it over. Number 57 14:01, 31 August 2020 (UTC)
@Frietjes:, @Number 57: I think it's really better. Thanks you both for making it more readable! --Aréat (talk) 14:06, 31 August 2020 (UTC)
I've copied it over, so it's now live. Number 57 14:18, 31 August 2020 (UTC)

Suggested features

Now I've started using it on a few different articles, there are a few situations that it would be nice to account for in the end section of the table. (Frietjes, this is not an request for you to do it immediately, just a 'would be nice when someone has time'!). Cheers, Number 57 15:13, 31 August 2020 (UTC)

  • All party votes are unknown (e.g.) Could something like |party_votes=unknown be invoked to leave the total votes and percentages cells (in the row with totals seats) blank?
  • Some party votes are unknown (e.g.) Could the same |party_votes=unknown function also disable the calculation of percentages for the parties (as the total votes is unknown)
  • Invalid votes are unknown (e.g.) Currently if you don't enter a figure for invalid votes, the table assumes a figure of zero and calculates the valid/invalid split accordingly. Would it be possible to use |invalid=unknown to remove the number in the respective column, as well as the percentages in the valid/invalid/registered voters/turnout rows (so it would look something like the below)?
    •   Done
  • Turnout is known but electorate not Could |turnout=XX be invoked to add a figure to the Registered voters/turnout row, but leaving the registered voters column blank?
    •   Done (using 'turnout' paramenter)
  • Valid and invalid split is unknown (seems to be the case for this election) If |totalvotes= (or something) is invoked, could the valid and invalid rows disappear, just leaving the 'Total votes' and 'Registered voters/turnout' rows? Alternatively, if that's not possible, could the valid and invalid rows just remain blank?
  • Electorate and turnout are unknown If neither |electorate=unknown or |turnout=XX are invoked, can this row disappear?
    •   Done (if electorate is not entered)
  • No summary vote details known (e.g.) If none of the valid/invalid/registered voters figures are known, could all four rows (valid/invalid/total/registered) be made to disappear?
    •   Done (if invalid, electorate or turnout are not entered)

@Frietjes: I've just noticed that the 'Total' row for seats etc is not classed as 'sortbottom', so gets mixed up when clicking on the sorting arrows. Would you be able to fix this? Also, if you have a chance to look at any of the above suggestions, that would be great. Cheers, Number 57 19:54, 7 September 2020 (UTC)

Election box

Isn't this module basically a replacement of everything at {{List of election box templates}}? Not sure if that makes this redundant, or if this will make those redundant, but looks like they have a lot in common. If this is the better designed / easier to use system of templates, it might be worth looking into merging those in at some point. ProcrastinatingReader (talk) 18:59, 10 September 2020 (UTC)

It wasn't meant to be (the focus was on national elections), but long-term it certainly could incorporate that too. Currently I'm rolling it out to simple elections where needs for improvement can be identified, as detailed in the section above. Further amendments could be requested to add some of the features in the election box templates (like the bottom line showing party hold/gain).
It's certainly a good idea to try this though as I occasionally see some awful messes made of election box templates (editors using ones that don't match up column-wise). Number 57 19:08, 10 September 2020 (UTC)

Pourcentage swing

Hello @Frietjes:. Sorry to bother you again with this template, but I have a request for a change. It's apparent on some election pages a column showing the swing of the percentages of votes would be a great addition, considering some electoral system can lead to a decrease in seats for a party when its vote share actually increased (and vice versa). Is it possible? Cordially.--Aréat (talk) 19:09, 4 October 2020 (UTC)

I think I have managed to do this partially in the sandbox (see the results at Template:Election results/testcases#Parliamentary). However, I have only been able to do it for the party rows – I cannot work out where you would add the bit for the 'total' row (although all it needs there is a dash (–). Number 57 19:14, 4 October 2020 (UTC)
@Aréat: I think I've cracked it, and have added it to the code. You should be able to add swings to tables now using "sw1", "sw2" etc. Number 57 20:18, 7 October 2020 (UTC)
Thank you ! Fantastic job, Number 57. --Aréat (talk) 22:10, 7 October 2020 (UTC)

Sortable

Should we turn off that feature for single-winner elections that are done, and featured just one round? Howard the Duck (talk) 19:17, 21 January 2021 (UTC)

It might be a bit complex because it would require three conditions to be met to be turned off – candidate parameter called and seats and second round vote parameters not called. It the sorting that big a problem? Some readers might find it helpful to be able to sort by candidate or party name, especially in elections with a large number of candidates. Cheers, Number 57 19:37, 21 January 2021 (UTC)
Sorting is a nuisance. It's like sporting league tables, which are almost always not sortable (although it can be interesting to know easily which team had the most goals, it doesn't matter almost all the time). Is sorting by names done correctly? Does it sort by family name automatically? Or do we need another template to use so that it'll sort correctly? Some ballots do list names alphabetically. I could probably be interested in sorting by party names after the election, but before that, I don't think so.
Sorting may be handy in multi-winner legislative elections though, I won't dispute that. If coding is too hard to sort this out, I'd probably leave it, or find someone who can do that. Howard the Duck (talk) 19:46, 21 January 2021 (UTC)
Frietjes would be able to advise whether it's possible. I tried turning off the sortable parameter in the sandbox when the conditions above were met, but couldn't get the syntax right. Number 57 19:49, 21 January 2021 (UTC)

Table for staggered elections

For staggered elections, the seat won totals are mostly irrelevant; what's important are the seats after the election. That should also mean that there should also be columns for "seats before", "seats not up", and "seats up". Not related to staggered elections, but can be useful for FPTP elections are columns for "seats gained", "seats lost", "seats held", and "new seats won". Useful for all elections are columns for "Number of candidates" and percentage of seats won/seats after. Howard the Duck (talk) 16:20, 1 February 2021 (UTC)

It's on my to-do list to create additional columns for elections like this (up to three additional seat columns with customisable headings which would also work for elections like this). I've got a bit of time next week so will try and get it sorted. Number 57 17:34, 1 February 2021 (UTC)
I'd recommend on keeping the customized headings to a bare minimum. Aside from those suggestions, what else are needed, and if they are a feature in multiple countries' elections, might as well make it an optional but not customizable header. If the goal is to have election tables look the same (barring English variants), having customizable headers defeats that. Howard the Duck (talk) 18:32, 1 February 2021 (UTC)

I have added up to five seats columns to the code. The top heading is 'Seats', but the ones under it are customisable because they may be used for multiple types of elections (see below). In terms of how to input this:

  • The headings can be named using the parameters seattype1=, seattype2= etc
  • The seat figures themselves can be entered using st1t1= (seat type 1 for party1), st2t1= (seat type 2 for party1), st1t2= (seat type 1 for party2) etc.
  • The totals are filled in using total_st1t=, total_st2t= etc. Unfortunately these cannot autototal as in some cases non-numerals may be entered (e.g. if using the columns for seat change).

Some examples of how these can be used:

If there is a need for a sixth column, this can be added relatively easily. Cheers, Number 57 19:05, 12 February 2021 (UTC)

Can we autohide vote columns if they're not present? Some elections have the vote totals lost to history. Howard the Duck (talk) 20:58, 13 February 2021 (UTC)
I'll have a look at how it can be done. Number 57 21:03, 13 February 2021 (UTC)
This functionality has now been added (see an example at 1951 Cambodian general election). The votes and % columns will not appear if no figures are entered for votes, invalid, totalvotes, electorate or turnout. Cheers, Number 57 22:22, 24 February 2021 (UTC)

Running Mates

Is there a way to include both running mates and double simultaneous vote? Further, there are many countries in which it is common for the running mate to be of a different party from the presidential candidate, often due to alliances. Would that be something that this template should provide for or would it not be important enough? Krisgabwoosh (talk) 18:12, 28 February 2021 (UTC)

It can be done easily, but I would question whether it's a good idea – when I added the dsv functionality I didn't think to include the running mate column because DSV results tables are already quite wide – do we really want to add another column to them? I would certainly not want to add another party column (if a VP was from a different party and we wanted to list them, it could perhaps be done in brackets after their name?). TBH, I am not convinced about the usefulness of the running mate column at all. I've seen it added to a few articles where (IMO) it really made quite a mess of the results table. Number 57 20:07, 28 February 2021 (UTC)

Plus–minus sign

I think that we should change "+/–" to "±" as the latter is the appropriate symbology. Jay Coop · Talk · Contributions 00:05, 5 March 2021 (UTC)

I am not sure it is. I have mostly seen the current one used. Number 57 00:07, 5 March 2021 (UTC)

Coalitions and sub-parties

I have two additions to suggest, the first which is going to be really useful for multiple countries, and the second that is not as useful, but may be done at one point.

1. Coalition: Many countries and election have coalitions, which would thus be extremely useful to have in this template/module. An example would be:

PartySeats
WonBy-electionTotal
Republicans15099249
Orléanists2149223
Legitimists1823185
Liberals78078
Bonapartists20323
Total644114758
Source: Rois et Presidents, Payot

A proposed way of implementing it would be to, for this example, have:

  • coalition1party1 = Orléanists
  • coalition1party2 = Légitimists
  • coalition1 = Monarchist majority
  • coalition2party1 = Republican Left
  • coalition2party2 = Center-Left
  • coalition2party3 = Republican Union
  • coalition2 = Republican opposition
  • party3 = Bonapartists

Thus, the "coalitionN" argument would replace a "partyN" argument in the same way "rowN" does currently.

2. Sub-parties: This one doesn't have the same priority, but it would be useful as well. For example, the Spanish election boxes sometimes have this:

Summary of the 10 November 2019 Congress of Deputies election results
 
Parties and coalitions Popular vote Seats
Votes % ±pp Total +/−
Spanish Socialist Workers' Party (PSOE) 6,792,199 28.00 –0.67 120 –3
People's Party (PP) 5,047,040 20.81 +4.12 89 +23
Vox (Vox) 3,656,979 15.08 +4.82 52 +28
United We Can (Unidas Podemos) 3,119,364 12.86 –1.46 35 –7
United We Can (PodemosIU) 2,381,960 9.82 –1.24 26 –7
In Common We Can–Let's Win the Change (ECP–Guanyem el Canvi) 549,173 2.26 –0.09 7 ±0
In Common–United We Can (PodemosEU) 188,231 0.78 –0.13 2 ±0

The Unidas Podemos line has multiple sub-parties. This would also be useful for other countries, such as the apparentments in Switzerland and the minority parties in the German Empire, though it's far less important than the coalitions addition. Julio974 (Talk-Contribs) 09:27, 21 February 2021 (UTC)

I think the first one is virtually impossible to recreate due to the mix of row and colspans required (as the module build all party rows from a single example). The second one is feasible if the percentages and totals can be manually input (and could be used as a substitute for the style in the first table). I'll have a look at this in the next few weeks. My next 'project' for the template is to enable it to do two-vote parliamentary elections.
There are small number of formats that are simply not going to be possible to build using this module (like the Uruguayan lema-based elections), so would have to be be configured manually using Wikitables, but keeping the same style as this produces. Number 57 11:50, 21 February 2021 (UTC)
Looking at the code of the module (well, quickly, I'm not yet used to lua), it doesn't look like it would be too difficult to implement the coalitions (the left part would just need creating a column with the needed color and a rowspan counting the number of parties, while adding an extra colspan=2 for the parties outside of coalitions; the "coalition summary" part would just need to add a type of row similar to the "rowN" type). For the sub-parties, the totals and percentages wouldn't need to be inputted manually, just for the totals function to ignore the sub-parties votes. Julio974 (Talk-Contribs) 12:33, 21 February 2021 (UTC)
By all means have a go at recreating it in the sandbox if you think it's possible. I wonder whether this style might be better though, especially for cases when there are quite a few parties in the coalition – readers may want to see the coalition name displayed first rather than listed at the bottom.
With regards to table 2, how would the code know which rows contain sub-parties? I think manual entry is desirable anyway (as there are some elections for which not all parties' votes are known), or only percentages are known, as in table 1 above (although it actually looks like someone has back-calculated the percentages from the seat totals, so if that's a real table, it needs fixing). Number 57 12:48, 21 February 2021 (UTC)

OK, so i have developed something that allows alliance totals to be displayed. It is much the same as the first style, but minus the additional colour column. It's not perfect (it won't work very well if there is a mix of alliances and contesting parties way through the table, but was much simpler to code. Also, because it allow manual input of votes and percentages that do not contribute to the total row, it can be used for cases where we have the votes for some parties, but not all. Number 57 21:08, 14 March 2021 (UTC)

 
PartyVotes%+/–Seats+/–
Kuomintang5,813,69966.15+4.5550+50
Democratic Progressive Party2,274,58625.88–4.5545–10
Progressive Alliance7,888,82592.030.0095+40
Labour Party400,0004.550.0060
Liberal Party300,0003.410.007+3
Lib–Lab Alliance700,0007.960.0013+3
Total8,788,285100.001080
Valid votes8,788,28599.99
Invalid/blank votes6450.01
Total votes8,788,930100.00
Registered voters/turnout19,806,00044.38
Source: CEC

Line break feature

Could we please implement a line break feature/dividing feature, or a way of highlighting parties, so readers can quickly and easily distinguish at a glance parties that won at least one seat vs parties that didn't? For examples see Results of the 2021 Scottish Parliament election or 2018 Bavarian state election#Election result where this division is implemented. I’ve been told this is currently not possible using this template but can be done on a standard wikitable so I think we should be able to use this feature here as well. Helper201 (talk) 17:43, 11 May 2021 (UTC)

I don't think this is a good idea, largely because I often see these lines misused. For instance, it should definitely not be used in the Scottish results table because there is no cut-off for winning seats in the constituency votes column (nor technically in the list vote either, as it's not decided at a national level), plus parties can win seats without contesting the list vote, which means they would be listed near the bottom of the table (as normal practice is to sort by proportional vote share). While it doesn't actually contain a line, the 2003 Scottish Parliament election shows what kind of mess you end up making of the vote order if you try and have all the parties that won seats grouped at the top. The only time these lines should be used (if people actually want them) is in purely proportional elections. However, given that these types of elections always have the parties that win seats at the top, I don't really see that the line then serves a purpose. Number 57 21:03, 11 May 2021 (UTC)

Template-protected edit request on 14 June 2021

Please see the discussion above on allowing WP editors to adjust the level of precision in percentages that the template produces. Thank you. – S. Rich (talk) 06:58, 14 June 2021 (UTC) – S. Rich (talk) 06:58, 14 June 2021 (UTC)

You don't have consensus for introducing this change. Number 57 08:19, 14 June 2021 (UTC)

Citation format

Currently, the practice for these template is to source them with a url and the name of the publisher, formatted as an external link. This prevents them from showing up in article reference lists, and also lacks most of the attributes suggested in the WP:CITEWEB guideline. The template seems to handle normal citation templates without issue, so perhaps they could be used, or if the source publisher is important than it can be listed with a reference number after it, eg. CEC[1]. CMD (talk) 01:35, 13 June 2021 (UTC)

On the frwiki, we add the sources as normal ones to the table's title. Maybe it could be used here too? Just a suggestion, though.--Aréat (talk) 02:21, 13 June 2021 (UTC)
That would also work, although it would require a change to the template coding. CMD (talk) 08:02, 13 June 2021 (UTC)
As citations can be added in the source section, I don't see the issue here. Editors can choose to use that format if they want – it's not a matter for the template code. The issue seems to be with common practice (which is not limited to this template's use), so would be better off being raised at WT:E&R. Number 57 10:38, 13 June 2021 (UTC)
The issue is the practice, as described in the documentation. I'll point to here from E&R. CMD (talk) 10:50, 13 June 2021 (UTC)
Use here is based on common practice prior to this template's creation. This is an issue that covers all election articles, not just ones that use this template (see e.g. 2017 German federal election#Results). Therefore I don't see how having the discussion here is appropriate. Number 57 10:59, 13 June 2021 (UTC)
I raised this discussion here at Template talk:Election results because I noticed the issue in this template, and saw that it is codified in the template documentation. I have pointed here from TW:E&R, although I have no objection to the discussion being moved and/or more widely advertised if you feel that would make more sense. CMD (talk) 11:17, 13 June 2021 (UTC)
Before having a discussion, it would be helpful.to understand what you actually want/expect. Do you want standard practice across election articles (and the documentation) to be to use CEC[2] as the example of how to do it? I don't think this can be achieved through code as there is a mix of using the two methods and in some cases multiple sources or footnotes in that line, so I think inserting automatic ref tags would create a mess. Number 57 11:25, 13 June 2021 (UTC)
Citations should meet the WP:Citing sources guideline, such as WP:CITEWEB. Currently the sources are formatted as WP:External links. I suggested two ways that would not require any code changes at all, Aréat's suggested a method that might require a code change. If you want to make it automatic I don't have an objection, I am mostly bringing up the issue with the current system. CMD (talk) 14:12, 13 June 2021 (UTC)
I'm still not entirely sure what you're after here. The template doesn't determine how editors add the source – it just gives an example. Do yo want the documentation changed to give a different example of how to do it? Getting editors to add it in this way on a consistent basis is a question for the WikiProject talk page. Cheers, Number 57 17:00, 13 June 2021 (UTC)
I'm not sure what is unclear here. Citations should not be formatted as WP:External links. The current documentation uses external links to showcase its sources, and so its examples should be changed to a format that meets the WP:Citing sources guideline. I provided two possibilities that would achieve this, Aréat provided a third. CMD (talk) 02:43, 14 June 2021 (UTC)
OK, I've amended the template documentation examples. Number 57 08:22, 14 June 2021 (UTC)
Thanks. The Guernsey and Belarus examples will need tweaking. The Belarus link seems dead actually, so might be a useful example of adding an archived link. Happy to make these changes myself if that is preferable. CMD (talk) 08:52, 14 June 2021 (UTC)
I can't see any examples in the documentation that haven't been changed?? Number 57 08:58, 14 June 2021 (UTC)
They were pointing to the Taiwan source, rather than the previous links. I've adjusted. CMD (talk) 09:33, 14 June 2021 (UTC)

References

  1. ^ "1996 Presidential and Vice Presidential Election". Central Election Commission. 23 August 2017. Retrieved 13 June 2021.
  2. ^ "1996 Presidential and Vice Presidential Election". Central Election Commission. 23 August 2017. Retrieved 13 June 2021.

{{undue precision}} in the percentages

MOS:PERCENT and MOS:UNCERTAINTY should apply in the template results along with the article text. But the template locks in results to show "xx.xx%" figures. In turn this causes inconsistency in article presentation. Editing rationale – how important or useful is a xx.xx% result? Not much. That is, election winners need to get 50% + one vote of the total. They do not need 50.01% or even 50.000000001% of the total because such numbers give us undue precision. (The same idea hold true in plurality (voting) systems.) So I suggest the template be modified to give the reader xx.x% figures. E.g., when the winner has more than 50% of a vote the table percentage number can/will show up as 50.x%. In turn the losers will show up as <49.9% (or whatever they actually get). More editing rationale – articles about elections typically say "candidate X won by 5%" in the text, or say "the results were 55–45% for candidates Joe and Blow". When we have such text the election table results should have the same level of precision in order to present consistent results. – S. Rich (talk) 18:19, 8 June 2021 (UTC)

2dp is fairly standard on election results tables and this issue goes well beyond this template. You're better off asking this question at WT:E&R as a generic question about how many decimal places results tables should use (as many do not use this template). Number 57 18:27, 8 June 2021 (UTC)
From experience, the two decimals is indeed by far the standard in election results across the world. I very rarely see election result with only one, and would be strongly opposed to the use a rounding when someone can do it extremely easily by himself out of reading two decimals, while you can't unround it when only being told one decimal.--Aréat (talk) 19:48, 8 June 2021 (UTC)

@Ythlev, Number 57, and Aréat: Thanks for the E&R suggestion. For now I've added the wikiproject to this page. To expand on my concern (stated above), this template make is more difficult to achieve WP:consistency. That is, articles with election results will end up with a mix of zero-dp, 1-dp, and 2-dp figures when we use this template and other sources. Thus the over-precision problem is a WP:MOS concern. Also, it falls outside of WP:CALC – we want to present "a meaningful reflection of the sources." The sources (vote counts) are the data. In turn the percentage calculations must be meaningful. So, can the template be revised to allow editors to adjust the numbers of decimal places? That is what I ask and recommend. – S. Rich (talk) 05:41, 11 June 2021 (UTC)

I fail to see in which MOS it is said that election results should be with one decimal, only that there must be consistency. Again, having two doesn't prevent one to read it as one, but having only one lessen the information given, with no way for the reader to know the two decimals. Considering this, the way to go is to have consistency with two decimals in both result table and infobox, not the other way around. I disagree with the implementation of a function that would automatically make the table's content less full fledged than it is right now.--Aréat (talk) 06:27, 11 June 2021 (UTC)
I'm also struggling to see the logic here. I don't see the problem with saying "Candidate X was elected with 56% of the vote" in the prose and then having a figure with decimal points in the tables (infobox/results), and I think this would be considered a normal way of writing about/presenting the results. On the subject of consistency, currently the template ensures consistency between articles, while the proposal to allow it to be varied would introduce inconsistency. Number 57 10:30, 11 June 2021 (UTC)

Well, I made the mistake of presenting two different concerns. First, I was arguing that election result percentages in articles do not need the exact number by which a candidate won. When they got 50% plus one vote they were in. But that is an editing concern for the WikiProject and how election results should be presented. Second, I'm concerned that this particular template does not have enough flexibility to allow editors to present the appropriate level of percentage precision. Example: candidate X gets 75% of the vote against candidates Y (with 24%) and Z (with 1%). Are we giving the readers a WP:SUMMARY STYLE article if the template table lists "Candidate X – 74.98%, Candidate Y – 23.61%, Candidate Z – 1.41%"? No. There is no special reason to do so. MOS:LARGENUM says "The number of decimal places should be consistent within a list or context, or significant in themselves for some special reason." When using the template we need to adjust the decimal places so the reader can see a consistent presentation. I hope the template gurus can adjust the parameteres. Thank you. – S. Rich (talk) 06:53, 14 June 2021 (UTC)

Again, the numbers in a table do not need to be consistent with what's written in prose. If we wrote in a prose that a candidate won with over three million votes, would you then expect to see simply > 3,000,000 in the results table? Results tables are not summaries – they are the full results. Number 57 08:30, 14 June 2021 (UTC)
I agree. Again, we shouldn't make the detailled result table a summary because summaries are used in the pages. We may give a simplified version in some leading sentence, and give the full results in the tables for the readers to check. It's the same idea as with infobox. We use them as short visuals of the result, often cutting to a few or just two candidates, but it doesn't mean we have to cut the actual result tables of any other data for consistency.--Aréat (talk) 08:07, 16 June 2021 (UTC)

Some more functionalities that can be added

  • Toggling left-most color column. Currently, these are included by default. Some elections are nonpartisan (2011 Singaporean presidential election), only involve one party, or the colors themselves aren't really important. It's a good idea that we can toggle this.
  • Electoral symbols instead of colors. Some cultures prefer symbols instead of colors.
  • Alliances. Somebody asked this above but I do recognize it's hard to code, nor is there a universal way of presenting this.
  • Column headers. You can calculate separate totals for coalitions/alliances in some elections, aside from party totals. If this is possible, having this customizable helps.
  • Seat columns. I guess we should make this official? I suppose customizing this is important but there are things that are universal enough for all people to understand, and to have it automatically calculated (seats before+seats won=seats after; seats after-seats before=seat change; or adding up the totals row at the bottom)
  • Boldfacing seats column?
  • Footnotes. These don't work unless you'd do it under the customized seats labels.
  • Adding v-t-e buttons for those inside templates.

If we do these, would the code would be unnecessarily complicated? If it does make it that way, would it be a good idea to create separate templates for 1) ca single district/seat, 2) the entire assembly? Howard the Duck (talk) 21:10, 5 July 2021 (UTC)

PartySymbolVotes%
Independent 4,661,07588.79
Independent 588,62211.21
Total5,249,697100.00
Valid votes5,249,69798.69
Invalid/blank votes69,5051.31
Total votes5,319,202100.00
Registered voters/turnout6,916,13476.91
Source: CEC
  • The colour column can be removed by using |row = instead of |cand = or |party =
  • I am not sure this is a good idea. I've seen it on a few Indian articles, and it was almost always the case that symbols were used for only a few parties, leaving it looking a bit of a mess. However, it can already be done in a way (see right)
  • Alliances can already be shown – see Template:Election results/testcases#With alliances
  • Column headings – do you want the 'Party' column to have an amendable title like the candidate one? (|candtitle = can be used to change it)
  • Not completely sure what you are asking, but if it's that the |st1t1 = columns are modified to do auto-totalling, this isn't possible as they will not always be used for seat figures – some columns may be used for seat changes – so have to be open text to accept plus symbols, New or dashes. The summing can only work if a pure number is entered.
  • Not sure what you mean by bolding the seat column. Why would this be needed?
  • Footnotes can't be done for the same reason as the multiple seat columns above – it will prevent autototalling. I'd recommend adding them in the party/candidate field if needed.
  • This probably can be done, but also probably shouldn't because I think consensus via multiple TfDs is that having results tables on templates is a bad idea (as they have few watchers and are prone to vandalism) – huge numbers of them have been deleted in the last few years. However, consistency can be achieved by having results tables coded onto one article and called on others using {{#section-h:Article name|Results}} (see e.g. 10th Parliament of Singapore, which calls the results table from the main election article).
Cheers, Number 57 21:27, 5 July 2021 (UTC)
  • If you're obsessive-compulsive, one can distinguish the difference between "|row" and "|party" but I suppose for the reader the difference isn't important.
  • I don't handle elections such as this, but I suppose it's good contingency if ever.
  • I noticed that, but there are better ways to present it. (I actually tried doing it that way before this template was created but was unsatisfied and used this template instead without alliances).
  • Yes, I suppose that can be easily done.
  • We can do 4 "pure number" columns then leave one for +/- that's plaintext. Howard the Duck (talk)
  • There are some election tables that do this: 2017 French legislative election. Sports tables do have this to draw attention to which statistic really matters.
  • I actually tried doing this on the party columns but it ended up not showing up the associated color.
  • I don't really get that. It's quite hard to edit transcluded sections just as how you've described it vs. using templates. Is it still recommended to create templates for results tables? Howard the Duck (talk) 22:10, 5 July 2021 (UTC)
  • I've added |partytitle = to allow editors to change the 'Party' heading to 'Alliance'. It can also be used to change 'Party' to 'Candidate' when using row rather than cand as I realised this defaults to 'Party'.
  • Another method of showing alliances may be the way it's done in Spanish articles, although I would need to play about with it (or ask for expert help) to see whether the cell lines can be removed (making parties small and excluding them from the total count can be done). I'm still not convinced separate party and alliance columns are possible (except in cases where you input a alliance and party name into every row) due to the issue of rowspanning. I'm also a bit wary about how much extra code this may require.
  • Re the 4 pure number columns, it won't work because in some results tables you have seats, seat change, seats, seat change (e.g. 1989 Bolivian general election#Results)
  • Not convinced the optional bolding of the seats column is a good idea as it will lead to inconsistency if it's enabled on some articles but not others. I think it should probably be an all or none thing, so probably needs a wider discussion (not here) on whether it's a good thing or not.
  • Can you show me an example of where the footnote stopped the colour displaying? It works at 2017 Nepalese general election#Results (third row). If there is no meta template associated with the row you're adding a footnote to, you have to add a color parameter to make it work (see the Rastriya Shiva Sena Party–Rastriya Nagarik Party row in the same table).
  • I would say not, and hardly any seem to be created anymore (I suspect almost all will be gone within a year at the current rate of deletion). The same process (mass deletion of templates, replaced with hard-coded instances) also happened with football league tables (and I guess probably other subjects – football is just one I'm aware of).
Cheers, Number 57 22:47, 5 July 2021 (UTC)
  • Great. Thanks.
  • I also saw that and I didn't like it either. I prefer the Italian presentation, but yes, that should be complicated coding.
  • I thought I saw that it didn't work with a footnote. I guess not now.
  • Would we just be limiting to just 5 customizable columns? I thought this can be easily done if a column is not customizable or is meant to display just pure numbers.
  • I checked the 2020 election articles, and mostly are now hardcoded into the primary article, and not on a separate template. A few others that are not yet using this template is using the old electionable, such as Template:2020 New Zealand election. I know for a fact that for football league tables it is no longer the case. I guess we should move on with clunky includeonly on these articles too... Howard the Duck (talk) 23:15, 5 July 2021 (UTC)
I'll have a go at doing something like the Italian version. Re the autototalling for multiple seat columns, it might be possible to have slightly different inputs (so st1t1 and sst1t1, with one being for numbers and one not). I'll see if I can work this out too as I have some time off in the next week. Number 57 10:14, 6 July 2021 (UTC)
Autosumming of multiple seat columns is now implemented. All columns will produce a sum – including ones with a non-numerical entry. For those types of columns, the text for the total row can be entered using the previous parameters (total_st1t, total_st2t etc). If no total parameter is entered, it will sum anything that looks like a pure number (so a column with +7, +3 and –4 will end with a total of '10' as it recognises the + numbers as positive integers, but not the last one, and it won't display the + symbol). See here for an example. Cheers, Number 57 18:20, 26 July 2021 (UTC)
Also now sorted out alliances in the Italian style – see Template:Election results/testcases#With alliances (2). Totals for the alliances are optional (and have to be manually calculated). Cheers, Number 57 19:26, 4 August 2021 (UTC)

electorate showing always as "registered voters"

In quite some countries (like the US) there is voter registration. That's why in this template "electorate" is shown as "Registered voters" on the template. However for example in the Kingdom of the Netherlands, voter registration is not normally necessary, as election status is directly determined based on nationality and voting cards are sent out directly based on national address databases (BRP). Therefore "registered voters" may be formally corrected (they were registered that the live in a certain municipality), but it doesn't feel correct (they didn't register to vote). Could we have the option to have "electorate" showing as "eligible to vote", as was done in certain voting tables before this table was rolled out widely? L.tak (talk) 21:14, 5 August 2021 (UTC)

Although people have not had to register themselves, they are still registered via another method. I think it's preferable to be consistent on how this is presented across Wikipedia rather than create the possibility for exceptions, which will almost certainly not be applied consistently. Sources like the IFES or the Nohlen books use the same terminology ("Registered voters") across countries despite different methods of registration. I also checked the previous results tables on the most recent Dutch elections before this template was used, and 'Registered voters' was used for both the 2012 and 2017 ones. The 2010 table did not include it. Cheers, Number 57 21:37, 5 August 2021 (UTC)
In Curacao, it was changed for 2016 (but those are now up for deletion...). The problem I have with it is that it makes people compare a turnout in -say- a US state with the turnout in -say- Curacao, where those are very different things. The term "registered voters" is not used in the Netherlands for a reason. I do therefore think it would be advantageous to show this in the template. It is not a bit problem however, as we could also get back to old templates for NL, which we could then tweak... L.tak (talk) 21:44, 5 August 2021 (UTC)
Turnout is different for a range of reasons (electoral systems, compulsory voting etc), not just how voters are registered. The big issue here is introducing inconsistency as the possibility of changing the wording will not be applied consistently. The main purpose of this template was to avoid these situations. And sources do use 'registered voters' for Dutch elections. Cheers, Number 57 22:08, 5 August 2021 (UTC)

Percentage of votes

In some countries like Iran, the percentage of blank or invalid votes are counted as part of the result, reducing from percentage of votes recieved by candidates. So technically, a candidate ranked in the first place may not reach the threshold to take the seat and a run-off would be called up. I see that this useful template counts automatically counts the percentage ithou regarding the blank or invalid votes. Is there an option to calculate the percentage this way? Pahlevun (talk) 21:15, 12 October 2021 (UTC)

You can do this – see e.g. 2018 Colombian presidential election#Results where blank votes are legally counted as valid votes (effectively 'none of the above').
However, I would be wary of including invalid votes as valid. While some election commissions may calculate results this way for the purposes of thresholds, in my experience third party sources tend to calculate percentages using valid votes only. Number 57 22:00, 12 October 2021 (UTC)

Party color template not working inside this template

@Primefac and Frietjes: I've noticed that the {{Party color}} template that is replacing the /meta/color templates is not working inside this template (see e.g. 1999 Greenlandic general election, where the colour is not appearing for Siumut in the first row of the results table). {{party color|Siumut (pre-2021)}} (which is used) does chuck out #F8F9FA, but it's not being picked up in the template. I've seen this in other articles where {{Party color}} has been added, so that article is not an anomaly. Cheers, Number 57 14:29, 6 December 2021 (UTC)

Looks like this is an issue somewhere around Module:Election_results#L-514; if colorX is nil then it goes for the /meta/color template, otherwise... it does nothing? Primefac (talk) 15:16, 6 December 2021 (UTC)
@Primefac: There is a color1 in the results table on that article, as you can see here, so it isn't nil. Number 57 16:31, 6 December 2021 (UTC)
Yes, my point is there's something in the module itself that is not jiving with what is being passed to it. I am not familiar with the module so I cannot say specifically what that issue is, but I did manage to locate the general location to start figuring things out. Primefac (talk) 20:21, 6 December 2021 (UTC)
@Primefac and Number 57: this should be fixed now, with some other code tweaks to make it easier to move this to directly calling Module:Political party in the future (needs a direct module entry point, see sandboxes). basically, the old templates would typically send the color with nowiki tags around it to prevent the # from being parsed as an ordered list item. the new system uses &#35; instead. for some reason when this gets pushed through the module, there is some encoding that turns the & into &amp; and the semicolon into some backslashed character. so, I put in some code to change the &#35; into # which seems to fix the problem. I don't know if this is a problem elsewhere, and there may be a clever way to search for it, but I don't know what that is at the moment. Frietjes (talk) 17:01, 7 December 2021 (UTC)
@Frietjes: Thanks! You are welcome to change this module over to fully using Module:Political party for colours in all cases, if the code is sorted. This is probably one of the last big users of /meta/color templates and holding up their deletion. Cheers, Number 57 12:49, 8 December 2021 (UTC)
@Number 57: now implemented. it will still check for the meta/color templates if the module lookup fails, but only if the module lookup fails. once all the meta/color templates are transclusionless and deleted, we can remove that second part. let me know if you see any problems and revert my changes if those problems are serious. thank you. Frietjes (talk) 23:17, 8 December 2021 (UTC)
That's great, thanks! Number 57 23:22, 8 December 2021 (UTC)

Separate invalid and blank votes

In most of Latin America invalid and blank votes are counted separated. It could be added this something like this:

|blank=43597
|blank2=38024
|invalid=44597
|invalid2=53193

When a number is added in "blank", "Invalid/blank votes" changes to "Invalid votes"

It will show like this:

Candidate Running mate Party First round Second round
Votes % Votes %
Luis Alberto Lacalle Pou Beatriz Argimón National Party 696,452 29.70 1,189,313 50.79
Daniel Martínez Graciela Villar Broad Front 949,376 40.49 1,152,271 49.21
Ernesto Talvi Robert Silva Colorado Party 300,177 12.80
Guido Manini Ríos Guillermo Domenech Open Cabildo 268,736 11.46
César Vega Andrés Chucarro Partido Ecologista Radical Intransigente 33,461 1.43
Edgardo Novick Daniel Peña Party of the Folk 26,313 1.12
Pablo Mieres Mónica Bottero Independent Party 23,580 1.01
Gonzalo Abella Gustavo López Popular Unity 19,728 0.84
Gustavo Salle Ana Cordano Green Animalist Party 19,392 0.83
Daniel Goldman Diego Ruete Digital Party 6,363 0.27
Rafael Fernández Andrea Revuelta Workers' Party 1,387 0.06
Total 2,344,965 100 2,341,584 100
Valid votes 2,344,965 96.37 2,341,584 96.23
Blank votes 43,597 1.79 38,024 1.56
Invalid votes 44,597 1.83 53,193 2.19
Total 2,433,364 100 2,433,196 100
Registered voters/turnout 2,699,978 90.13 2,699,980 90.12
Source: Corte Electoral

--Yilku1 (talk) 02:56, 19 October 2020 (UTC)

I don't think this is necessary; the totals of invalid and blank ballots are reported separately by electoral commissions of many countries, but are usually listed as one in secondary sources. Number 57 09:06, 19 October 2020 (UTC)
I know it isn't the practise on the wiki eng to show the blank vote separatedly. To share a different view, I would wan't to point the exemple of the situation in France, in which showing it this way has been pursued for a long time and only successfully so in recent years. The meaning for many people is that an invalid vote only show a misunderstanding of the electoral process or an act of vandalism on the ballot, while a blank vote is the expression of a choice in itself, that say "None of these choice are worth to me". One that is expressed for this purpose. The registered voter could have stayed home, but made the decision to go all the way to the polling booth to make that specific "No choice". It is an important part of the analysis of an election. While a low participation rate can also be seen as a dissatisfaction of the system or candidates by the voters, it also can just be general apathy, or even in the current situation the fear of a pandemic. Meanwhile, a high invalid vote share can be interpreted as a problem with the voting system, and finally, a high blank vote show voters who do want to take part of the electoral process, but are dissatisfied with the choices given. As can be seen recently in the second round of the french presidential election, for example. I think there's merit in showing them as separate data. I imagine it's not how it's done in many other countries - I know american don't even count them in presidential election -, but to someone who always read some bits of analysis about it after an election, it feel normal to have it included. Cordially. --Aréat (talk) 09:31, 19 October 2020 (UTC)
Having taken part in numerous election counts and handled ballot papers, I'm not sure I agree with this analysis. Many invalid votes are cast in a way that also says "None of these choice are worth to me", such as striking through all the candidates or writing (usually rude) comments about the choices on offer. I would say the vast majority of invalid votes in UK general elections are of this type. Number 57 09:46, 19 October 2020 (UTC)
That's because is not used that way in the UK, but in many countries in Latam is exactly like Aréat said. --Yilku1 (talk) 23:26, 21 October 2020 (UTC)

To raise this matter again, I would like to point out the situation int the recent 2021 Peruvian general election. In the first round, there were 2,190,059 blank votes, an impressive 12.36% of the total, with 1,123,027 invalid votes (6.34%). Meanwhile, in the second round, there were only 121,477 blank votes, equalling to a mere 0.64%, with 1,108,039 invalid votes (5.88%), roughly the same. The difference in blank votes may show a rejection of the political system in the first round, with an increased pick of candidate in the second round in the context of a close race between very polarizing candidates. Meanwhile, the amount of invalid votes remain the same. It seem to me this show how different the two data are, and how we should be able to differenciate them in the template when the sources make it possible.--Aréat (talk) 07:48, 16 June 2021 (UTC)

@Yilku1: @Number 57: Would again be useful as seen here. Isn't it possible to implement it?--Aréat (talk) 00:13, 8 December 2021 (UTC)

It is possible to implement it, I'm just not sure it's necessary. I'll mock up the code when I have some time though. Number 57 12:53, 8 December 2021 (UTC)
@Aréat: Finally done. Number 57 19:47, 1 March 2022 (UTC)
Thanks a lot! It was the only remaining problem I saw in the template. --Aréat (talk) 06:50, 2 March 2022 (UTC)

Color problems

[1] [2] [3] [4] in these four articles i had to copy and paste the name because the color didnt work

could somebody explain what i actually changed Braganza (talk) 16:57, 26 March 2022 (UTC)

It's some odd character that appears to be a regular space, but isn't. I noticed this a while ago, and tried to search for it, but it didn't seem possible to search for this specific character... It wasn't a problem when we were using the meta/color templates, but has appeared since they were transferred into the module. Number 57 17:20, 26 March 2022 (UTC)
It's the replacement of hidden unicode spaces. Primefac (talk) 17:43, 26 March 2022 (UTC)

Footnotes on invalid/blank votes

Is it possible? Some elections have candidates who withdrew or died prior to the election but remained on the ballot. In some jurisdictions, votes for such candidates are counted as invalid, and some are kept for statistics; in cases such as that, it'll be improper for the withdrawn/deceased candidate to be included with the rest of the candidates in the totals if the authority themselves do not do so. Howard the Duck (talk) 14:40, 11 April 2022 (UTC)

It's not possible to add footnotes to anything that is included in the totalling or percentage calculations (which includes the invalid votes). I would add a footnote in the sources section instead. Cheers, Number 57 16:32, 11 April 2022 (UTC)
I tried doing this at Template:1998 Philippine presidential election results and this wasn't the best way of presenting this. Howard the Duck (talk) 18:00, 12 April 2022 (UTC)
Also, the footnote per se is on the column for "Invalid/blank votes", not on the column where the figures are. Howard the Duck (talk) 18:17, 12 April 2022 (UTC)
Ah ok. I've added an 'invalidnote' parameter, which will appear next to invalid/blank. You need to use {{efn}} or something for it to appear. See here in the testcases. Cheers, Number 57 18:08, 13 April 2022 (UTC)
Great! This works as intended. Howard the Duck (talk) 20:30, 13 April 2022 (UTC)

Thousands separators, how to format?

It currently uses commas as a thousands separators. How can one set it to use other separators where for instance commas are used as decimal separators? 39,766 vs 39766. -- Jeandré, 2022-05-07t10:27z

Are you planning to copy the code for another language Wikipedia? I believe it may automatically set to the local wiki's appropriate format based on lines 33-35. Cheers, Number 57 12:27, 7 May 2022 (UTC)
Not sure if N57 is implicitly saying "not going to happen", but I will - whether US or UK English, this is the English Wikipedia, and both countries use a comma as separator, so it would be illogical to assume that a comma is a decimal separator. Primefac (talk) 14:27, 7 May 2022 (UTC)

Unrepresented vote

Is it possible to add below invalid/blank votes an optional row of Unrepresented vote? Or Gallagher index? — Preceding unsigned comment added by HudecEmil (talkcontribs) 01:38, 28 June 2022 (UTC)

I don't think this is a worthwhile addition. The results table should be core information, and neither of those fall under that. Number 57 16:23, 29 June 2022 (UTC)

Blank votes as valid

Serveral electoral commissions around the world include the blank votes (but not the invalid ones) in the computation of the final percentages, that somehow can impact if a party made it past the threshold or not. Is there a way, using this template, to have blank votes considered as invalid? Or alternatively, is there a way to not trigger automatically the "invalid/blank votes" label for the "invalid" entry whenever blank votes are not openly specified (since this would allow to specify blank votes as an extra "party")? Fm3dici97 (talk) 06:49, 17 October 2022 (UTC)

Like this ? It was reverted, though. --Aréat (talk) 07:28, 17 October 2022 (UTC)
It can be done, as is done on Colombian election articles (e.g. here). Use the "row" function add blank votes and then add invalidonly=yes.
However, this should only be done where blank votes are counted as valid votes (a form of 'none of the above') rather than simply being used for threshold calculations. Number 57 09:47, 17 October 2022 (UTC)

Wrong "minus" sign in the header

It seems that the source code has the header string "+/−" with the correct minus sign, but it somehow gets replaced in the final results by "+/-" with the hyphen instead of minus, thus violating MOS:MINUS. Please repair. (Or maybe use "±" instead of "+/−"?). — Mikhail Ryazanov (talk) 20:01, 31 March 2023 (UTC)

Where are you seeing +/-? Number 57 21:10, 31 March 2023 (UTC)
For example, Template:Election results#Parliamentary election, the header of the last column (and 3rd from right; by the way, the negative numbers there also wrongly have en dashes instead of minus signs, in violation of MOS:MINUS). — Mikhail Ryazanov (talk) 01:44, 1 April 2023 (UTC)
I don't know how you're seeing +/-, as that's not what's there. Copy/pasting directly from that table, the header rows are +/– and +/–, not +/-. Number 57 13:06, 1 April 2023 (UTC)
OK, it's actually not a hyphen but an en dash (in the font I'm using, they are difficult to distinguish without context). This still violates MOS:MINUS, which explicitly says: "Do not use ... dashes". — Mikhail Ryazanov (talk) 18:55, 1 April 2023 (UTC)
I checked the source code and it does not use the minus sign. However, I have now replaced it so it does. Number 57 11:50, 2 April 2023 (UTC)
Actually, this creates issues – when a minus sign is used, the header starts breaking when the table is compressed, which doesn't happen with the endash. Given they are practically indistinguishable (no-one has raised this issue in several years), I will leave the endash in place until someone can work out how to solve that issue. Number 57 11:57, 2 April 2023 (UTC)
They are "practically indistinguishable" only in some fonts, but are drastically different in other (see how dashes look different in different fonts). And even when the en dash has the same width as the minus sign, it's usually positioned slightly lower (since dashes are mostly designed to look well among lower-case letters, while the minus and plus signs are designed to be used mostly with digits, which in most fonts look like capitals). This makes it look particularly bad near the plus sign.
If there is a problem with line breaks, just wrap it in {{nobr}} (or use its CSS/HTML equivalent). And why, in the first place, it's "+/−" instead of "±", like in, for example, {{Historical populations}}? — Mikhail Ryazanov (talk) 01:13, 3 April 2023 (UTC)
Using a nobr template doesn't work in a module. If you know the correct CSS/HTML to use, by all means implement it in sandbox. I tried and I couldn't get it to work. Number 57 13:09, 3 April 2023 (UTC)
Before I try, let me ask a third time: why not just "±"? — Mikhail Ryazanov (talk) 22:31, 3 April 2023 (UTC)
Because ± does not mean +/−, it refers to a choice between values. This was discussed regarding due to its (incorrect) use on another template here. Number 57 21:25, 4 April 2023 (UTC)
If we are talking about semantics, the arguments in that discussion look strange (if Howard the Duck claims that "±" doesn't have the necessary meaning, then in must be shown that "+/−" does). Moreover, neither "±" nor "+/−" refers to a choice between values, as you say. That column actually is supposed to show the change. And should then be titled simply in words as "Change" or "Diff.", or using the established notation "Δ". — Mikhail Ryazanov (talk) 22:04, 4 April 2023 (UTC)
+/- has the advantages of being shorter and self evident. It's been used on hundred of pages since decades and as far as I know nobody complained about not understanding it. --Aréat (talk) 23:13, 4 April 2023 (UTC)
Are you going to try and get the minus sign to work in the sandbox or not? This is increasingly verging on sealioning. Number 57 16:49, 5 April 2023 (UTC)

Government formation

In multi-party parliamentary elections, multiple parties participate in coalitions to form the government. Is there any way to highlight which parties are part of the governing coalition? Avisnacks (talk) 11:44, 17 April 2023 (UTC)

I don't think this is a good idea at all. There is usually an "Aftermath"/"Government formation" section, which would be the appropriate place to do this. Number 57, 20:10, 17 April 2023 (UTC)

Colors to a row

Is there a way to add a color to a row? For exemple, in the Parliamentary election table on the page, in the Guernesey 2020 exemple, I would like to add a color to the "Appointed seats" line, to fit with the color used in the diagram above. In a similar way, in the 2017 Kazakh Senate election, I would like to differentiate between the rows of "appointed seats", usually shown as circled, and seats directly elected, but in the previous election, not up in 2017. Aréat (talk) 06:34, 14 February 2023 (UTC)

To use a colour, use "party" instead of "row" as the parameter. Rows are designed not to have the colour column. Cheers, Number 57 09:48, 14 February 2023 (UTC)
Thanks!--Aréat (talk) 03:54, 15 February 2023 (UTC)
@Number 57: I think they should allow it for situations such as this one. What do you think ?--Aréat (talk) 02:11, 1 September 2023 (UTC)
If you want a colour, use the party parameter. The whole point of the row function is not to have a coloured line. I don't think colours should be used for the rows you mention. Cheers, Number 57 07:59, 1 September 2023 (UTC)

Fixed widths

Is it possible, or is there a reason why this is not done? Howard the Duck (talk) 05:18, 8 September 2023 (UTC)

It wasn't done because making tables fixed width creates problems such as unnecessarily wide tables with tonnes of whitespace (like this) or columns that aren't wide enough resulting in unnecessary row breaks (like this). Cheers, Number 57 15:59, 8 September 2023 (UTC)