Difference between revisions of "Template:Seats"
m |
(examples added; minor corrections in the code) |
||
Line 2: | Line 2: | ||
<p style="width: {{{p1percent|0}}}%; background: {{{p1color|rgb(255, 201, 14)}}}; {{#ifexpr: {{{p2percent|0}}} = 0|border-radius: 5px|border-radius: 5px 0 0 5px}}; padding: 5px 0 5px 0; margin: 0; display: inline-block;">{{#ifexpr: {{{p1percent|0}}} > 0|{{{p1percent|0}}}%}}</p><p style="width: {{{p2percent|0}}}%; background: {{{p2color|rgb(239, 228, 176)}}}; {{#ifexpr: {{{p3percent|0}}} = 0|border-radius: 0 5px 5px 0;}} padding: 5px 0 5px 0; margin: 0; display: inline-block;">{{#ifexpr: {{{p2percent|0}}} > 0|{{{p2percent|0}}}%}}</p><p style="width: {{{p3percent|0}}}%; background: {{{p3color|rgb(181, 230, 29)}}}; {{#ifexpr: {{{p4percent|0}}} = 0|border-radius: 0 5px 5px 0;}} padding: 5px 0 5px 0; margin: 0; display: inline-block;">{{#ifexpr: {{{p3percent|0}}} > 0|{{{p3percent|0}}}%}}</p><p style="width: {{{p4percent|0}}}%; background: {{{p4color|rgb(153, 217, 234)}}}; {{#ifexpr: {{{p5percent|0}}} = 0|border-radius: 0 5px 5px 0;}} padding: 5px 0 5px 0; margin: 0; display: inline-block;">{{#ifexpr: {{{p4percent|0}}} > 0|{{{p4percent|0}}}%}}</p><p style="width: {{{p5percent|0}}}%; background: {{{p5color|rgb(112, 146, 190)}}}; border-radius: 0 5px 5px 0; padding: 5px 0 5px 0; margin: 0; display: inline-block;">{{#ifexpr: {{{p5percent|0}}} > 0|{{{p5percent|0}}}%}}</p> | <p style="width: {{{p1percent|0}}}%; background: {{{p1color|rgb(255, 201, 14)}}}; {{#ifexpr: {{{p2percent|0}}} = 0|border-radius: 5px|border-radius: 5px 0 0 5px}}; padding: 5px 0 5px 0; margin: 0; display: inline-block;">{{#ifexpr: {{{p1percent|0}}} > 0|{{{p1percent|0}}}%}}</p><p style="width: {{{p2percent|0}}}%; background: {{{p2color|rgb(239, 228, 176)}}}; {{#ifexpr: {{{p3percent|0}}} = 0|border-radius: 0 5px 5px 0;}} padding: 5px 0 5px 0; margin: 0; display: inline-block;">{{#ifexpr: {{{p2percent|0}}} > 0|{{{p2percent|0}}}%}}</p><p style="width: {{{p3percent|0}}}%; background: {{{p3color|rgb(181, 230, 29)}}}; {{#ifexpr: {{{p4percent|0}}} = 0|border-radius: 0 5px 5px 0;}} padding: 5px 0 5px 0; margin: 0; display: inline-block;">{{#ifexpr: {{{p3percent|0}}} > 0|{{{p3percent|0}}}%}}</p><p style="width: {{{p4percent|0}}}%; background: {{{p4color|rgb(153, 217, 234)}}}; {{#ifexpr: {{{p5percent|0}}} = 0|border-radius: 0 5px 5px 0;}} padding: 5px 0 5px 0; margin: 0; display: inline-block;">{{#ifexpr: {{{p4percent|0}}} > 0|{{{p4percent|0}}}%}}</p><p style="width: {{{p5percent|0}}}%; background: {{{p5color|rgb(112, 146, 190)}}}; border-radius: 0 5px 5px 0; padding: 5px 0 5px 0; margin: 0; display: inline-block;">{{#ifexpr: {{{p5percent|0}}} > 0|{{{p5percent|0}}}%}}</p> | ||
− | <div style="font-weight: normal; text-align: left;">{{#ifeq: {{{key|}}}|1|{{ | + | <div style="font-weight: normal; text-align: left;">{{#ifeq: {{{key|}}}|1|{{Seats/Key|p1color={{{p1color|}}}|p2color={{{p2color|}}}|p3color={{{p3color|}}}|p4color={{{p4color|}}}|p5color={{{p5color|}}}|p1={{{p1|}}}|p2={{{p2|}}}|p3={{{p3|}}}|p4={{{p4|}}}|p5={{{p5|}}}|seats={{{seats|}}}}}}} |
− | {{#ifexpr: {{{p5percent|0}}} = 0|{{ | + | {{#ifexpr: {{{p5percent|0}}} = 0|{{Seats/NoSeat}}}}</div></div></includeonly> |
− | <noinclude>{{Complex}} | + | <noinclude>{{Complex}}{{-}}{{TOCright}} |
+ | '''This template is used to visually show the Congress representation.''' Below you can see the usage, code samples and examples of this code samples. | ||
− | : | + | :''If you are an editor and would like a breakdown of this template's complex code, please see [[Template talk:Seats]]'' |
− | '''For optimal use''', please arrange the parties in descending order by | + | ==Usage== |
− | == | + | '''For optimal use''', please arrange the parties in descending order by the number of votes, such that the party that gets 50% of the vote is Party 1, the party that gets 40% of the vote is Party 2, and so forth. |
− | <pre>{{Seats| | + | |
+ | Following is the usage with information about each parameter. For clean usage, scroll down to [[#Clean usage]]. | ||
+ | |||
+ | <!-- CURRENTLY NOT WORKING; omitted from the list below; | ||
+ | seats= | Set "seats" to the number of total seats decided in the election to display it in the key. --> | ||
+ | <pre> | ||
+ | {{Seats| | ||
+ | key=1| <!-- OPTIONAL: Set "key" to 1 to display the key underneath the bar -->. | ||
+ | width=| <!-- OPTIONAL: Set "width" to a custom value (numbers only, no % or px since the template automatically uses px) to set the graph to a custom width. If not used; 800 is predefined; --> | ||
+ | |||
+ | p1=First party name| <!-- party name with largest number of Congress seats. OPTIONAL if you don't use key=1 --> | ||
+ | p1percent=40| <!-- put percentage number for the party with largest number of Congress seats --> | ||
+ | p1color=#5D8AA8| <!-- OPTIONAL: bar color code for the party with largest number of Congress seats --> | ||
+ | p2=Second party name| <!-- party name with second largest number of Congress seats. OPTIONAL if you don't use key=1 --> | ||
+ | p2percent=30| <!-- put percentage number for the party with second largest number of Congress seats --> | ||
+ | p2color=#F0F8FF| <!-- OPTIONAL: bar color code for the party with second largest number of Congress seats --> | ||
+ | p3=Third party name| <!-- party name with third largest number of Congress seats. OPTIONAL if you don't use key=1 --> | ||
+ | p3percent=20| <!-- put percentage number for the party with third largest number of Congress seats --> | ||
+ | p3color=#E32636| <!-- OPTIONAL: bar color code for the party with third largest number of Congress seats --> | ||
+ | p4=Fourth party name| <!-- party name with fourth largest number of Congress seats. OPTIONAL if you don't use key=1 --> | ||
+ | p4percent=12| <!-- put percentage number for the party with fourth largest number of Congress seats --> | ||
+ | p4color=#EFDECD| <!-- OPTIONAL: bar color code for the party with fourth largest number of Congress seats --> | ||
+ | p5=Fifth party name| <!-- party name with fifth largest number of Congress seats. OPTIONAL if you don't use key=1 --> | ||
+ | p5percent=8| <!-- put percentage number for the party with fifth largest number of Congress seats --> | ||
+ | p5color=#E52B50| <!-- OPTIONAL: bar color code for the party with fifth largest number of Congress seats --> | ||
+ | }} | ||
+ | </pre> | ||
+ | |||
+ | Note regarding color: '''Color names, #000000, or rgb(255, 255, 255) may be used. If no color is specified, default colors are used:''' | ||
+ | |||
+ | {{/Key| | ||
+ | p1color=#FFC90E| | ||
+ | p2color=#EFE4B0| | ||
+ | p3color=#B5E61D| | ||
+ | p4color=#99D9EA| | ||
+ | p5color=#7092BE| | ||
+ | }} | ||
+ | |||
+ | ==Clean usage== | ||
+ | <pre> | ||
+ | {{Seats| | ||
key=1| | key=1| | ||
+ | width=| | ||
− | p1= | + | p1=| |
− | p1percent= | + | p1percent=| |
− | p2= | + | p1color=| |
− | p2percent= | + | p2=| |
− | p3= | + | p2percent=| |
+ | p2color=| | ||
+ | p3=| | ||
+ | p3percent=| | ||
+ | p3color=| | ||
+ | p4=| | ||
+ | p4percent=| | ||
+ | p4color=| | ||
+ | p5=| | ||
+ | p5percent=| | ||
+ | p5color=| | ||
+ | }} | ||
+ | </pre> | ||
+ | |||
+ | ==Sample Code with examples== | ||
+ | ===Sample 1=== | ||
+ | No party names, no specific codes. Only the percentages used and width decreased. | ||
+ | |||
+ | <pre>{{Seats| | ||
+ | width=400| | ||
+ | p1percent=40| | ||
+ | p2percent=30| | ||
p3percent=12| | p3percent=12| | ||
− | |||
p4percent=10| | p4percent=10| | ||
− | |||
p5percent=8| | p5percent=8| | ||
}}</pre> | }}</pre> | ||
− | |||
− | |||
− | |||
− | + | {{Seats| | |
− | + | width=400| | |
− | + | p1percent=40| | |
− | + | p2percent=30| | |
− | p1percent= | + | |
− | + | ||
− | + | ||
− | p2percent= | + | |
− | + | ||
− | + | ||
p3percent=12| | p3percent=12| | ||
− | |||
− | |||
p4percent=10| | p4percent=10| | ||
− | |||
− | |||
p5percent=8| | p5percent=8| | ||
− | + | }} | |
− | }} | + | |
− | + | ||
− | == | + | ===Sample 2=== |
− | {{Seats| | + | Full list with not-linkable fake parties. This is completely made-up example. |
+ | <pre>{{Seats| | ||
key=1| | key=1| | ||
p1=Progressive Party| | p1=Progressive Party| | ||
− | p1percent= | + | p1percent=40| |
+ | p1color=#766| | ||
p2=Moderate Party| | p2=Moderate Party| | ||
− | p2percent= | + | p2percent=30| |
+ | p2color=#888| | ||
p3=Conservative Party| | p3=Conservative Party| | ||
− | p3percent= | + | p3percent=20| |
+ | p3color=#900| | ||
p4=Communist Party| | p4=Communist Party| | ||
p4percent=10| | p4percent=10| | ||
+ | p4color=#877| | ||
p5=Fascist Party| | p5=Fascist Party| | ||
− | p5percent= | + | p5percent=0| |
− | }} | + | p5color=#999| |
+ | }}</pre> | ||
{{Seats| | {{Seats| | ||
− | key= | + | key=1| |
p1=Progressive Party| | p1=Progressive Party| | ||
− | p1percent= | + | p1percent=40| |
+ | p1color=#766| | ||
p2=Moderate Party| | p2=Moderate Party| | ||
− | p2percent= | + | p2percent=30| |
+ | p2color=#888| | ||
p3=Conservative Party| | p3=Conservative Party| | ||
− | p3percent= | + | p3percent=20| |
+ | p3color=#900| | ||
p4=Communist Party| | p4=Communist Party| | ||
p4percent=10| | p4percent=10| | ||
+ | p4color=#877| | ||
p5=Fascist Party| | p5=Fascist Party| | ||
− | p5percent= | + | p5percent=0| |
+ | p5color=#999| | ||
}} | }} | ||
− | {{Seats| | + | ===Sample 3=== |
+ | Full list with linkable parties. This example is taken from [[Congress of the Netherlands]] article; September 2011 elections. | ||
+ | <pre>{{Seats| | ||
key=1| | key=1| | ||
+ | p1=[[Democratisch Nederland]]| | ||
+ | p1percent=42.5| | ||
+ | p1color=#3333cc| | ||
+ | p2=[[Geuzen Partij Nederland]]| | ||
+ | p2percent=25| | ||
+ | p2color=#C9C5DE| | ||
+ | p3=[[Iron & Wine]]| | ||
+ | p3percent=22.5| | ||
+ | p3color=#ffcc33| | ||
+ | p4=[[Centre-Left Netherlands]]| | ||
+ | p4percent=5| | ||
+ | p4color=#d82000| | ||
+ | p5=Rote Armee Fraktion| | ||
+ | p5percent=5| | ||
+ | p5color=#9d4e40| | ||
+ | }}</pre> | ||
− | p1= | + | {{Seats| |
− | p1percent= | + | key=1| |
− | p1color=# | + | p1=[[Democratisch Nederland]]| |
− | p2= | + | p1percent=42.5| |
− | p2percent= | + | p1color=#3333cc| |
− | p2color=# | + | p2=[[Geuzen Partij Nederland]]| |
− | p3= | + | p2percent=25| |
− | p3percent= | + | p2color=#C9C5DE| |
− | p3color=# | + | p3=[[Iron & Wine]]| |
− | p4= | + | p3percent=22.5| |
− | p4percent= | + | p3color=#ffcc33| |
− | p4color=# | + | p4=[[Centre-Left Netherlands]]| |
− | p5= | + | p4percent=5| |
− | p5percent= | + | p4color=#d82000| |
− | p5color=# | + | p5=Rote Armee Fraktion| |
− | }} | + | p5percent=5| |
− | + | p5color=#9d4e40| | |
− | + | }}</noinclude> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | </noinclude> | + |
Revision as of 14:57, 3 June 2020
This template is used to visually show the Congress representation. Below you can see the usage, code samples and examples of this code samples.
- If you are an editor and would like a breakdown of this template's complex code, please see Template talk:Seats
Usage
For optimal use, please arrange the parties in descending order by the number of votes, such that the party that gets 50% of the vote is Party 1, the party that gets 40% of the vote is Party 2, and so forth.
Following is the usage with information about each parameter. For clean usage, scroll down to #Clean usage.
{{Seats| key=1| <!-- OPTIONAL: Set "key" to 1 to display the key underneath the bar -->. width=| <!-- OPTIONAL: Set "width" to a custom value (numbers only, no % or px since the template automatically uses px) to set the graph to a custom width. If not used; 800 is predefined; --> p1=First party name| <!-- party name with largest number of Congress seats. OPTIONAL if you don't use key=1 --> p1percent=40| <!-- put percentage number for the party with largest number of Congress seats --> p1color=#5D8AA8| <!-- OPTIONAL: bar color code for the party with largest number of Congress seats --> p2=Second party name| <!-- party name with second largest number of Congress seats. OPTIONAL if you don't use key=1 --> p2percent=30| <!-- put percentage number for the party with second largest number of Congress seats --> p2color=#F0F8FF| <!-- OPTIONAL: bar color code for the party with second largest number of Congress seats --> p3=Third party name| <!-- party name with third largest number of Congress seats. OPTIONAL if you don't use key=1 --> p3percent=20| <!-- put percentage number for the party with third largest number of Congress seats --> p3color=#E32636| <!-- OPTIONAL: bar color code for the party with third largest number of Congress seats --> p4=Fourth party name| <!-- party name with fourth largest number of Congress seats. OPTIONAL if you don't use key=1 --> p4percent=12| <!-- put percentage number for the party with fourth largest number of Congress seats --> p4color=#EFDECD| <!-- OPTIONAL: bar color code for the party with fourth largest number of Congress seats --> p5=Fifth party name| <!-- party name with fifth largest number of Congress seats. OPTIONAL if you don't use key=1 --> p5percent=8| <!-- put percentage number for the party with fifth largest number of Congress seats --> p5color=#E52B50| <!-- OPTIONAL: bar color code for the party with fifth largest number of Congress seats --> }}
Note regarding color: Color names, #000000, or rgb(255, 255, 255) may be used. If no color is specified, default colors are used:
Clean usage
{{Seats| key=1| width=| p1=| p1percent=| p1color=| p2=| p2percent=| p2color=| p3=| p3percent=| p3color=| p4=| p4percent=| p4color=| p5=| p5percent=| p5color=| }}
Sample Code with examples
Sample 1
No party names, no specific codes. Only the percentages used and width decreased.
{{Seats| width=400| p1percent=40| p2percent=30| p3percent=12| p4percent=10| p5percent=8| }}
40%
30%
12%
10%
8%
Sample 2
Full list with not-linkable fake parties. This is completely made-up example.
{{Seats| key=1| p1=Progressive Party| p1percent=40| p1color=#766| p2=Moderate Party| p2percent=30| p2color=#888| p3=Conservative Party| p3percent=20| p3color=#900| p4=Communist Party| p4percent=10| p4color=#877| p5=Fascist Party| p5percent=0| p5color=#999| }}
40%
30%
20%
10%
Sample 3
Full list with linkable parties. This example is taken from Congress of the Netherlands article; September 2011 elections.
{{Seats| key=1| p1=[[Democratisch Nederland]]| p1percent=42.5| p1color=#3333cc| p2=[[Geuzen Partij Nederland]]| p2percent=25| p2color=#C9C5DE| p3=[[Iron & Wine]]| p3percent=22.5| p3color=#ffcc33| p4=[[Centre-Left Netherlands]]| p4percent=5| p4color=#d82000| p5=Rote Armee Fraktion| p5percent=5| p5color=#9d4e40| }}
42.5%
25%
22.5%
5%
5%