Template talk:Election results/Archive 2
![]() | This is an archive of past discussions. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page. |
Archive 1 | Archive 2 |
Width parameter
Hi, I very much love this template and prefere it over Election boxes:))). However one thing Election boxes get right is the consistent overall width of the rendered tables. It would be great to be able to set the width of {{Election results}} to create clear, consistent articles, e.g. when using multible {{Election results}} one below the other in one article, like here in Senate Constituency no. 2. Setting the width parameter for the same value in all templates would resolve the issue of visually unpleasing tables with different widths. — Antoni12345 (talk) 18:54, 11 November 2023 (UTC)
- Is this what you had in mind (i.e. being able to set a defined width for candidates and party columns)? Cheers, Number 57 14:16, 13 November 2023 (UTC)
Need Percentage of Total Electors
Add an additional value for the percentage (+/-) of Total Electors, calculated from the electors in the Previous Election. Make it simple.
|previouselectors=
and its not recommended for First elections of every state IJohnKennady (talk) 15:16, 26 November 2023 (UTC)
- I don't think this is necessary, and it wouldn't fit in the table. Number 57 16:03, 26 November 2023 (UTC)
Inaccessible text in new night (dark) theme
![]() | This edit request to Module:Election results has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
If you visit https://en.m.wikipedia.org/wiki/2024_South_Korean_legislative_election?minervanightmode=1 you'll see Registered voters/turnout and Total votes display as gray text on a black background.
Could the following diff please be applied to fix this ?
Thanks in advance! 🐸 Jdlrobson (talk) 06:17, 13 April 2024 (UTC)
- Module:Election results is fully protected. I've updated the request template from {{TPER}}.
- I've tested {{Election results/sandbox}} in a preview in Minerva night mode and it seems to work for me. Plus the proposed change makes sense with regard to the neighboring code
:css('background', 'inherit')
and the page mw:Help:Lint errors/night-mode-unaware-background-color. —andrybak (talk) 15:27, 13 April 2024 (UTC)Done For what it's worth I am not convinced this page really needs to be full protected. * Pppery * it has begun... 15:35, 13 April 2024 (UTC)
- With <9k transclusions, I generally agree. Primefac (talk) 14:53, 15 April 2024 (UTC)
- I've seen template-confirmed editors mess up other widely-used templates because they don't properly check the outcomes of their changes (it's amazing how many people don't check their changes in the sandbox) – for example, someone made a mess of {{Infobox election}} around a month ago. Due to the relatively high complexity of this module, a large number of testcases need to be checked when changes are made to make sure they don't inadvertently affect certain types of tables. With all this in mind, I would prefer this to remain fully-protected to make sure there is less chance of a big cock-up being made. Number 57 15:17, 15 April 2024 (UTC)
- Hrm... that's a reasonable argument. Primefac (talk) 15:19, 15 April 2024 (UTC)
- I've seen template-confirmed editors mess up other widely-used templates because they don't properly check the outcomes of their changes (it's amazing how many people don't check their changes in the sandbox) – for example, someone made a mess of {{Infobox election}} around a month ago. Due to the relatively high complexity of this module, a large number of testcases need to be checked when changes are made to make sure they don't inadvertently affect certain types of tables. With all this in mind, I would prefer this to remain fully-protected to make sure there is less chance of a big cock-up being made. Number 57 15:17, 15 April 2024 (UTC)
- With <9k transclusions, I generally agree. Primefac (talk) 14:53, 15 April 2024 (UTC)
Showing alliance on constituency elections
in some countries, the larger alliance is as important as the original party. One example is Malaysia, the Nordic countries, India and the Philippines. Would it be possible to add a separate column for alliance? I hacked this by using parenthesis, such as "Nationalist People's Coalition (UniTeam Alliance)" in Template:2022 Philippine Senate election results. Ideally a possible "Alliance" column is beside the "Party" column, either before or after. Howard the Duck (talk) 13:19, 2 May 2024 (UTC)
- You can already do this – see below. Cheers, Number 57 00:10, 4 May 2024 (UTC)
- Thanks! Would it be possible, if alliances are used, to default to the party if left blank? Howard the Duck (talk) 17:41, 4 May 2024 (UTC)
- Yes, if you use the alliance field but not party (you can put either a party or an alliance in the alliance field), it will appear as the second table below. Number 57 20:18, 4 May 2024 (UTC)
- Great. This should work and would align this with the actual per party results table. Howard the Duck (talk) 05:03, 5 May 2024 (UTC)
- Yes, if you use the alliance field but not party (you can put either a party or an alliance in the alliance field), it will appear as the second table below. Number 57 20:18, 4 May 2024 (UTC)
- Thanks! Would it be possible, if alliances are used, to default to the party if left blank? Howard the Duck (talk) 17:41, 4 May 2024 (UTC)
Candidate | Alliance and party | Votes | % | |||
---|---|---|---|---|---|---|
Robin Padilla | UniTeam Alliance | PDP–Laban | 26,612,434 | 52.31 | ||
Loren Legarda | MP3 Alliance | Nationalist People's Coalition | 24,264,969 | 47.69 | ||
Total | 50,877,403 | 100.00 |
Candidate | Alliance and/or party | Votes | % | |||
---|---|---|---|---|---|---|
Robin Padilla | UniTeam Alliance | PDP–Laban | 26,612,434 | 52.31 | ||
Loren Legarda | Nationalist People's Coalition | 24,264,969 | 47.69 | |||
Total | 50,877,403 | 100.00 |
Possible bug when votes against are unknown
In the 1986 Czechoslovak parliamentary election article, the table seems to add an extra column when the number of votes against, using the row2
and votes2
fields, is unknown. --Minoa (talk) 19:50, 19 May 2024 (UTC)
- Sorted. Cheers, Number 57 20:52, 19 May 2024 (UTC)
Adding # (ranks)
This would be hanby for multiple winner elections. I just dunno how it should be done as the color column is at the leftmost corner. Just make it optional, as the default should be the unnumbered version. Howard the Duck (talk) 13:19, 6 January 2024 (UTC)
Elections under multiple non-transferable vote
So I tried this out at Template:1946 Philippine Senate election results (sorry guys I know you wanted that to be deleted LOL) and there seems to be something missing for this type of election:
- It doesn't show you who won. Let's imagine the reader knows nothing about this election. Okay, I suppose the candidate at the top won, but if this was a single-winner election, how come there are so many votes, with more votes than the people who voted?
- I suppose the percentages should be based on the turnout and not on the total votes, but I've seen similar elections use the total votes as the dividend.
- For these types of elections, the top x candidates win, so having a "Rank" column is a good visual cue.
I know there's a two-seat variant of this template but it doesn't work for 3+ winners in an election. Howard the Duck (talk) 21:21, 1 September 2021 (UTC)
- You can add background colours for rows – see e.g. 1990 Slovenian presidential election#Presidency, and you can manually add bolding to candidate and party names.
- There may be a way to refactor percentages for candidate elections where people can vote for more than one, but what would the total figure for use of calculation be – would it be total votes cast for candidates or total number of voters casting valid votes (some voters may not use all their votes)? The total as it appears at the bottom would still be the total of votes cast for candidates, but I don't think this is an issue if you've got the valid votes line – there are many countries where the vote totals for parties are far larger than the electorate as voters have multiple votes (e.g. this or this). Not sure about adding a ranking column – potentially quite a bit of extra coding.
- Ultimately it won't be possible or worth it to adjust the template for every possible layout – while going through different countries to convert to this template, I've formatted some using wikitables because only a tiny number of tables would look like that and it's not worth the extra coding. Cheers, Number 57 21:41, 1 September 2021 (UTC)
- Background colors: I know you guys are talking about changing up the party color templates, but that Slovenian example has
the same exactsimilar color to Template:Nacionalista Party/meta/color (LOL), and I've been trying to change that but the last time I did that, someone reverted because "We're using it here everywhere".- Also, I tried these out, and it doesn't work unless you change
|cand
to|row
, but that got rid of the party column. Howard the Duck (talk) 22:04, 1 September 2021 (UTC)
- Also, I tried these out, and it doesn't work unless you change
- It depends per election authority. I checked out Manx elections, which used an identical format, and they divided by total number of votes cast (therefore the current setup should give out the same results). On Philippine elections interestingly, these are normally not presented with percentages. I suppose there can be a way to turn off this feature? Here at Wikipedia, Philippine Senate elections have always been presented with percentages, but are never presented that way elsewhere. I'm actually interested on how election authorities do this. Howard the Duck (talk) 21:55, 1 September 2021 (UTC)
- The row background colour is your choice; it isn't hardcoded to be that shade of green, I've just input that because that's what was used on the previous wikitable version. But good point re it only working on rows – that can be fixed. The percentage column could be hidden; I'll have a look at how much code that would take if you want. Number 57 22:23, 1 September 2021 (UTC)
- Yeah, I was more gunning on a yellow color, as that what is being used. Just keep us updated once this is fixed up. Howard the Duck (talk) 22:32, 1 September 2021 (UTC)
- The row background colour is your choice; it isn't hardcoded to be that shade of green, I've just input that because that's what was used on the previous wikitable version. But good point re it only working on rows – that can be fixed. The percentage column could be hidden; I'll have a look at how much code that would take if you want. Number 57 22:23, 1 September 2021 (UTC)
- Background colors: I know you guys are talking about changing up the party color templates, but that Slovenian example has
- Related question: For "partyx", is it supposed to be the full name of the party, the short name, or wherever the article name is at (except for disambiguation). Howard the Duck (talk) 21:59, 1 September 2021 (UTC)
- You can pipe in whatever name you like; the meta color is called using the link, so as long as that is correct, how you pipe it is irrelevant (Zimbabwe African National Union – Ndonga and ZANU–Ndonga both call the meta color). However, if you're not linking, then you need the full party name to get the meta color to work. Number 57 22:23, 1 September 2021 (UTC)
- Is there like a rule, or is it totally upon the discretion of anybody who's editing? If we're using US parties, is it recommended to be as "Democratic" or "Democratic Party" (or even "D")? Howard the Duck (talk) 22:32, 1 September 2021 (UTC)
- There isn't a rule as far as I'm aware. There may be consensus for individual countries in their respective politics projects. Personally I would always go for the full name of the party unless it's significantly longer than the others and distorts the table. 'Democratic' is fine for an infobox summary, but I don't think is appropriate in a table.
- Separately I've fixed the background colour for rows using 'cand1' etc. Will try and do the hiding percentages thing soon. Number 57 13:40, 11 September 2021 (UTC)
- Is there like a rule, or is it totally upon the discretion of anybody who's editing? If we're using US parties, is it recommended to be as "Democratic" or "Democratic Party" (or even "D")? Howard the Duck (talk) 22:32, 1 September 2021 (UTC)
- You can pipe in whatever name you like; the meta color is called using the link, so as long as that is correct, how you pipe it is irrelevant (Zimbabwe African National Union – Ndonga and ZANU–Ndonga both call the meta color). However, if you're not linking, then you need the full party name to get the meta color to work. Number 57 22:23, 1 September 2021 (UTC)
@Howard the Duck: The functionality to refactor percentages for elections where voters can cast multiple ballots has now been added. If you use the 'divisor' function, it will refactor the percentage column into a % of valid votes cast (rather than total votes cast for all candidates). See an example at 1866 Surinamese general election. Cheers, Number 57 21:50, 6 February 2024 (UTC)
- Thanks. Can we add an optional "#" leftmost column? In MNTV elections, the percentages or vote totals don't really matter, but on how you ranked in the tally. Howard the Duck (talk) 22:02, 6 February 2024 (UTC)
- I'd suppose there can also be an option to remove percentage column entirely. Howard the Duck (talk) 23:15, 6 February 2024 (UTC)
- Just to clarify, would the rank column be before the party colour one like this? It somehow seems a bit disjointed. Also, given tables are already ranked in order of votes received, what would be the purpose of the rank column?
# Candidate Party Votes % 1 Bill Jones Conservative Party 13,000 51.00 2 Eric Smith Independent 12,000 49.00
- Separately, removing the percentage column would potentially require quite a lot of code to be added to hide the columns in multiple parts of the table (as currently the % column automatically appears if the votes column is used). However, you can effectively do the same thing already by hacking the template slightly, as below. Number 57 16:26, 7 February 2024 (UTC)
- Yeah, I thought about the color column and the rank column and yes, it does look disjointed. However, I'd be ok with this if only we'd only show the rank column on multiple winner elections like MNTV and SNTV. I've peeked at WP:FLs, and the colour column, if there's a rank column, is quite far away from it; one colors the "#" column with the party color, but I won't recommend this. One more way is to put the color and the party columns together, but I've seen several election results tables that indeed show the color as the leftmost column (then again, those are single-winner elections), so people may be used to it, and expect it to be within that area of the results table.
- Re: The purpose -- for MNTV and SNTV, the winners are for the top X positions; the rank column allows the reader to visually know who among the top X are; in jurisdictions where this type of election is being used, the specific value of X has become somewhat drilled into brains of voters, like "I need X names for this position".
- One another way is boldfacing entire rows in results tables, like the old election tables, but it doesn't give you at first glance how many seats are contested in this "district". In cases such as 2023 Amber Valley Borough Council election, this is rather easy, as the winners are the top 2-3. In cases such as 2022 Calamba City Council elections, it's not readily apparent (I think it's 12, and I wasted 10 seconds of life counting it). Howard the Duck (talk) 22:12, 7 February 2024 (UTC)
- Re hack: This hack removes the party column, which is pretty essential. If hiding the % is too hard to do, I'd be ok with keeping it. Howard the Duck (talk) 22:12, 7 February 2024 (UTC)
- The hack doesn't get rid of the party column – I just didn't include it in the example – now added in to demonstrate it works.
- It is also possible to add background colour to rows (like in 2004 Norfolk Island legislative election) to demonstrate who was elected (which I think is much clearer way of demonstrating who was successful than bolding). But I will have a go at adding a # column in the near future. Cheers, Number 57 22:20, 7 February 2024 (UTC)
- i'd prefer bolding or even a checkmark than coloring an entire row (considering I've done that before lol) as we already color a cell for the party. This isn't like sports tables where we don't color an entire column.
- I like how the hack looks like now tho. Let me know how you want this done (by numbers, bolding or coloring then let's see how it works in actual usage. Howard the Duck (talk) 00:13, 8 February 2024 (UTC)
- It's in the code below. I used the seats function for the votes (and changed the title of the column using the |seatstitle parameter). Cheers, Number 57 23:00, 8 February 2024 (UTC)
- Is there a way to have the winners be made to stand out other than manually boldfacing every entry? Howard the Duck (talk) 22:52, 10 February 2024 (UTC)
- It's in the code below. I used the seats function for the votes (and changed the title of the column using the |seatstitle parameter). Cheers, Number 57 23:00, 8 February 2024 (UTC)
Candidate Party Votes Candidate A Party A 34,390 Candidate B Party B 25,440 Candidate C Party C 10,101 Total 69,931
- Separately, removing the percentage column would potentially require quite a lot of code to be added to hide the columns in multiple parts of the table (as currently the % column automatically appears if the votes column is used). However, you can effectively do the same thing already by hacking the template slightly, as below. Number 57 16:26, 7 February 2024 (UTC)