Template:Gallagher index/doc

From Wikipedia, the free encyclopedia

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

Gallagher Index 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]

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. See a monthly parameter usage report for Template:Gallagher index in articles based on its TemplateData.

TemplateData for Gallagher index

Creates a Gallagher index table using provided seat and vote percentages.

Template parameters

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
Float sideside

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

Suggested values
left right none
Example
left
Auto value
Stringrequired
Election nameelection

The name of the election, formatted as a wikilink

Example
[[2015 Canadian federal election]]
Page namerequired
Table sizesize

Scales the table, input is from 0-100 percent (no % sign), scales based on text size

Suggested values
70 100
Default
100
Example
70
Numberoptional
Explanation toggleexplanation

Toggles the explanatory paragraph at the bottom. Default enabled, "no" disables it.

Suggested values
yes no
Default
yes
Example
no
Auto value
yes
Unknownsuggested
Party 1 votes (%)votes1

Vote percentage received by party 1

Example
10.90
Numberoptional
Party 1 seats (%)seats1

Seat percentage received by party 1

Example
10.90
Numberoptional
Party 1 colorcolor1

Party color, as a hex value. Hex outputting templates accepted

Example
#00FF00
Unknownoptional
Party 1 nameparty1

The name of party 1, formatted as a wikilink

Example
[[Australian Greens|Greens]]
Unknownoptional
Party 2 votes (%)votes2

Vote percentage received by party 2

Example
10.90
Numberoptional
Party 2 seats (%)seats2

Seat percentage received by party 2

Example
10.90
Numberoptional
Party 2 colorcolor2

Party color, as a hex value. Hex outputting templates accepted

Example
#00FF00
Unknownoptional
Part 2 nameparty2

The name of party 1, formatted as a wikilink

Example
[[Australian Greens|Greens]]
Unknownoptional
Party 3 votes (%)votes3

Vote percentage received by party 3

Example
10.90
Numberoptional
Party 3 seats (%)seats3

Seat percentage received by party 3

Example
10.90
Numberoptional
Party 3 colorcolor3

Party color, as a hex value. Hex outputting templates accepted

Example
#00FF00
Unknownoptional
Party 3 nameparty3

The name of party 1, formatted as a wikilink

Example
[[Australian Greens|Greens]]
Unknownoptional
Party 4 votes (%)votes4

Vote percentage received by party 4

Example
10.90
Numberoptional
Party 4 seats (%)seats4

Seat percentage received by party 4

Example
10.90
Numberoptional
Party 4 colorcolor4

Party color, as a hex value. Hex outputting templates accepted

Example
#00FF00
Unknownoptional
Party 4 nameparty4

The name of party 1, formatted as a wikilink

Example
[[Australian Greens]]
Unknownoptional
Party 5 votes (%)votes5

Vote percentage received by party 5

Example
10.90
Numberoptional
Party 5 seats (%)seats5

Seat percentage received by party 5

Example
10.90
Numberoptional
Party 5 colorcolor5

Party color, as a hex value. Hex outputting templates accepted

Example
#00FF00
Unknownoptional
Party 5 nameparty5

The name of party 1, formatted as a wikilink

Example
[[Australian Greens|Greens]]
Unknownoptional
Party 6 votes (%)votes6

Vote percentage received by party 6

Example
10.90
Numberoptional
Party 6 seats (%)seats6

Seat percentage received by party 6

Example
10.90
Numberoptional
Part 6 colorcolor6

Party color, as a hex value. Hex outputting templates accepted

Example
#00FF00
Unknownoptional
Party 6 nameparty6

The name of party 1, formatted as a wikilink

Example
[[Australian Greens|Greens]]
Unknownoptional
Party 7 votes (%)votes7

Vote percentage received by party 7

Example
10.90
Numberoptional
Party 7 seats (%)seats7

Seat percentage received by party 7

Example
10.90
Numberoptional
Party 7 colorcolor7

Party color, as a hex value. Hex outputting templates accepted

Example
#00FF00
Unknownoptional
Party 7 nameparty7

The name of party 1, formatted as a wikilink

Example
[[Australian Greens|Greens]]
Unknownoptional
Party 8 votes (%)votes8

Vote percentage received by party 8

Example
10.90
Numberoptional
Party 8 seats (%)seats8

Seat percentage received by party 8

Example
10.90
Numberoptional
Party 8 colorcolor8

Party color, as a hex value. Hex outputting templates accepted

Example
#00FF00
Unknownoptional
Party 8 nameparty8

The name of party 1, formatted as a wikilink

Example
[[Australian Greens|Greens]]
Unknownoptional
Party 9 votes (%)votes9

Vote percentage received by party 9

Example
10.90
Numberoptional
Party 9 seats (%)seats9

Seat percentage received by party 9

Example
10.90
Numberoptional
Party 9 colorcolor9

Party color, as a hex value. Hex outputting templates accepted

Example
#00FF00
Unknownoptional
Party 9 nameparty9

The name of party 1, formatted as a wikilink

Example
[[Australian Greens|Greens]]
Unknownoptional
Party 10 votes (%)votes10

Vote percentage received by party 10

Example
10.90
Numberoptional
Party 10 seats (%)seats10

Seat percentage received by party 10

Example
10.90
Numberoptional
Party 10 colorcolor10

Party color, as a hex value. Hex outputting templates accepted

Example
#00FF00
Unknownoptional
Party 10 nameparty10

The name of party 1, formatted as a wikilink

Example
[[Australian Greens|Greens]]
Unknownoptional