Difference between revisions of "Template:Seats"
(examples added; minor corrections in the code) |
(text color change; category added) |
||
Line 1: | Line 1: | ||
<includeonly><div style="width: {{{width|800}}}px; text-align: center; font-weight: bold; margin: 5px;"> | <includeonly><div style="width: {{{width|800}}}px; text-align: center; font-weight: bold; margin: 5px;"> | ||
− | <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}}}%; color: white; 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}}}%; color: white; 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}}}%; color: white; 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}}}%; color: white; 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}}}%; color: white; 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|{{Seats/Key|p1color={{{p1color|}}}|p2color={{{p2color|}}}|p3color={{{p3color|}}}|p4color={{{p4color|}}}|p5color={{{p5color|}}}|p1={{{p1|}}}|p2={{{p2|}}}|p3={{{p3|}}}|p4={{{p4|}}}|p5={{{p5|}}}|seats={{{seats|}}}}}}} | <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|}}}}}}} | ||
Line 177: | Line 177: | ||
p5percent=5| | p5percent=5| | ||
p5color=#9d4e40| | p5color=#9d4e40| | ||
− | }}</noinclude> | + | }}[[Category:Graphical Aid Templates]]</noinclude> |
Latest revision as of 05:45, 10 October 2023
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%