Template:Gallagher index
Party | Votes (%) | Seats (%) | Difference | Difference squared | |
---|---|---|---|---|---|
Total of differences squared | 0 | ||||
Total / 2 | 0 | ||||
Square root of (Total / 2): Gallagher Index result | 0 | ||||
The Gallagher Index ranges from 0 to 100. Low indexes (close to 0) are very proportionate, high indexes (20 or greater) are very disproportionate. |
Usage
[edit]Creates a Gallagher index table that automatically calculates the Gallagher index based on provided vote and seat percentages.
{{Gallagher index
|election = Election name (wikilink preferred)
|side = Side for the table to float on, inputs "left" or "right" or "none" (no quotation marks)
|size = Size of table, default 70, expresses text size percentage (no % symbol)
|explanation = "no" disables the explanation of the Gallagher index at the bottom, otherwise it is enabled by default. (no quotation marks)
|color1 = First party color (templates allowed)
|party1 = First party name (wikilink preferred)
|votes1 = First party vote percentage (no % symbol)
|seats1 = First party seat percentage (no % symbol)
|color2 = Second party color
|party2 = Second party name
|votes2 = Second party vote percentage (no % symbol)
|seats2 = Second party seat percentage (no % symbol)
<!-- Continues till color10, party10, votes10 and seats10-->
}}
Parameters
[edit]Parameter | Description |
---|---|
|election=
|
The name of the election, wikilinks preferred |
|side=
|
The side that the table will float on, inputs are "left", "right" or "none" (no quotation marks). None will position the table on the left with text wrap, like a normal wikitable. |
|size=
|
The size of the table, as a percentage, default 70 (no % symbol) |
|explanation=
|
Disables the explanation at the bottom with input "no", otherwise it appears by default (no quotation marks) |
|party1=
|
The party's name, wikilinks preferred |
|color1=
|
The party's color, templates can be used. |
|votes1=
|
The party's percentage vote share. (No % symbol or comma decimal separator) |
|seats1=
|
The party's percentage seat share. (No % symbol or comma decimal separator) |
Parties can be numbered from 1-10 |
Example
[edit]Example result for the 2015 Canadian Federal Election
Party | Votes (%) | Seats (%) | Difference | Difference squared | |
---|---|---|---|---|---|
Liberal | 39.47% | 54.44% | 14.97 | 224.1009 | |
Conservatives | 31.89% | 29.29% | -2.6 | 6.76 | |
New Democratic | 19.71% | 13.02% | -6.69 | 44.7561 | |
Bloc Québecois | 4.66% | 2.96% | -1.7 | 2.89 | |
Green | 3.45% | 0.29% | -3.16 | 9.9856 | |
Other | 0.82% | 0.00% | -0.82 | 0.6724 | |
Total of differences squared | 289.165 | ||||
Total / 2 | 144.5825 | ||||
Square root of (Total / 2): Gallagher Index result | 12.02 | ||||
The Gallagher Index ranges from 0 to 100. Low indexes (close to 0) are very proportionate, high indexes (20 or greater) are very disproportionate. |
{{Gallagher index
|election = [[2015 Canadian federal election]]
|side = right
|size = 70
|explanation = yes
|color1 = {{Canadian party colour|CA|Liberal}}
|party1 = Liberal
|votes1 = 39.47
|seats1 = 54.44
|color2 = {{Canadian party colour|CA|Conservative}}
|party2 = Conservatives
|votes2 = 31.89
|seats2 = 29.29
|color3 = {{Canadian party colour|CA|NDP}}
|party3 = New Democratic
|votes3 = 19.71
|seats3 = 13.02
|color4 = {{Canadian party colour|CA|BQ}}
|party4 = Bloc Québecois
|votes4 = 4.66
|seats4 = 2.96
|color5 = {{Canadian party colour|CA|Green}}
|party5 = Green
|votes5 = 3.45
|seats5 = 0.29
|color6 = {{Canadian party colour|CA|Others}}
|party6 = Other
|votes6 = 0.82
|seats6 = 0
|party7 = Error example
|votes7 = Values such as 2%; 2,14; text; null/blank
|seats7 = Row will not be shown for any of these values
}}
Template Data
[edit]TemplateData for Gallagher index
Creates a Gallagher index table using provided seat and vote percentages.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Float side | side | Side for the table to float on, left or right. If none, the table will be left aligned with text wrap, like a normal wikitable
| String | required |
Election name | election | The name of the election, formatted as a wikilink
| Page name | required |
Table size | size | Scales the table, input is from 0-100 percent (no % sign), scales based on text size
| Number | optional |
Explanation toggle | explanation | Toggles the explanatory paragraph at the bottom. Default enabled, "no" disables it.
| Unknown | suggested |
Party 1 votes (%) | votes1 | Vote percentage received by party 1
| Number | optional |
Party 1 seats (%) | seats1 | Seat percentage received by party 1
| Number | optional |
Party 1 color | color1 | Party color, as a hex value. Hex outputting templates accepted
| Unknown | optional |
Party 1 name | party1 | The name of party 1, formatted as a wikilink
| Unknown | optional |
Party 2 votes (%) | votes2 | Vote percentage received by party 2
| Number | optional |
Party 2 seats (%) | seats2 | Seat percentage received by party 2
| Number | optional |
Party 2 color | color2 | Party color, as a hex value. Hex outputting templates accepted
| Unknown | optional |
Part 2 name | party2 | The name of party 1, formatted as a wikilink
| Unknown | optional |
Party 3 votes (%) | votes3 | Vote percentage received by party 3
| Number | optional |
Party 3 seats (%) | seats3 | Seat percentage received by party 3
| Number | optional |
Party 3 color | color3 | Party color, as a hex value. Hex outputting templates accepted
| Unknown | optional |
Party 3 name | party3 | The name of party 1, formatted as a wikilink
| Unknown | optional |
Party 4 votes (%) | votes4 | Vote percentage received by party 4
| Number | optional |
Party 4 seats (%) | seats4 | Seat percentage received by party 4
| Number | optional |
Party 4 color | color4 | Party color, as a hex value. Hex outputting templates accepted
| Unknown | optional |
Party 4 name | party4 | The name of party 1, formatted as a wikilink
| Unknown | optional |
Party 5 votes (%) | votes5 | Vote percentage received by party 5
| Number | optional |
Party 5 seats (%) | seats5 | Seat percentage received by party 5
| Number | optional |
Party 5 color | color5 | Party color, as a hex value. Hex outputting templates accepted
| Unknown | optional |
Party 5 name | party5 | The name of party 1, formatted as a wikilink
| Unknown | optional |
Party 6 votes (%) | votes6 | Vote percentage received by party 6
| Number | optional |
Party 6 seats (%) | seats6 | Seat percentage received by party 6
| Number | optional |
Part 6 color | color6 | Party color, as a hex value. Hex outputting templates accepted
| Unknown | optional |
Party 6 name | party6 | The name of party 1, formatted as a wikilink
| Unknown | optional |
Party 7 votes (%) | votes7 | Vote percentage received by party 7
| Number | optional |
Party 7 seats (%) | seats7 | Seat percentage received by party 7
| Number | optional |
Party 7 color | color7 | Party color, as a hex value. Hex outputting templates accepted
| Unknown | optional |
Party 7 name | party7 | The name of party 1, formatted as a wikilink
| Unknown | optional |
Party 8 votes (%) | votes8 | Vote percentage received by party 8
| Number | optional |
Party 8 seats (%) | seats8 | Seat percentage received by party 8
| Number | optional |
Party 8 color | color8 | Party color, as a hex value. Hex outputting templates accepted
| Unknown | optional |
Party 8 name | party8 | The name of party 1, formatted as a wikilink
| Unknown | optional |
Party 9 votes (%) | votes9 | Vote percentage received by party 9
| Number | optional |
Party 9 seats (%) | seats9 | Seat percentage received by party 9
| Number | optional |
Party 9 color | color9 | Party color, as a hex value. Hex outputting templates accepted
| Unknown | optional |
Party 9 name | party9 | The name of party 1, formatted as a wikilink
| Unknown | optional |
Party 10 votes (%) | votes10 | Vote percentage received by party 10
| Number | optional |
Party 10 seats (%) | seats10 | Seat percentage received by party 10
| Number | optional |
Party 10 color | color10 | Party color, as a hex value. Hex outputting templates accepted
| Unknown | optional |
Party 10 name | party10 | The name of party 1, formatted as a wikilink
| Unknown | optional |