Template:STV election graph
Graphs are unavailable due to technical issues. There is more info on Phabricator and on MediaWiki.org. |
This template employs intricate features of template syntax.
You are encouraged to familiarise yourself with its setup and parser functions before editing the template. If your edit causes unexpected problems, please undo it quickly, as this template may appear on a large number of pages. You can conduct experiments, and should test all major changes, in either this template's sandbox, the general template sandbox, or your user space before changing anything here. |
This template creates a formatted bar chart to display results of elections that use the single transferable vote, similar to {{Graph:Chart}}.
About
[edit]Each stage of the election is shown by a column, and the number of votes each candidate received at that stage is shown by a coloured bar within that column.
Non-transferable votes are calculated automatically by subtracting the total number of votes in any given round from the number of first-preference votes.
The template can currently display elections with up to 15 stages and 20 candidates.
Usage
[edit]The first two parameters are Counts
and Candidates
, both of which must be filled in for the template to function properly.
After this, each set of parameters relate to a particular candidate.
Parameter | Usage | Example |
---|---|---|
1Party |
Used to display the candidate's political party in the key. | 1Party=Fine Gael
|
1Colour |
The party's colour, in hexadecimal format. Don't use meta templates, as they break the syntax. | 1Colour=#6699FF
|
1Count1 |
The number of votes the candidate received at the first count. Continues in the series 1CountN , where N is the number of the count. Don't use thousands separators, as this also breaks the syntax. |
1Count1=4999
|
Candidates should either be ordered by first-preference votes (with the candidate with the highest vote using the 1
set of parameters, the second highest using 2
and so on), or by order of election (with the candidate elected first using the 1
set of parameters, the candidate elected second 2
and so on. Unsuccessful candidates should be ranked in reverse order of elimination, with the candidate eliminated first using the last set of parameters).
You may wish to enclose the bar chart in an {{Image frame}} template, which includes a caption and lets text wrap around the image.
Examples
[edit]Inserting...
{{STV election graph |Counts=3 |Candidates=3 |1Party=Labour |1Colour=#E4003B |1Count1=8000 |1Count2=700 |1Count3=6000 |2Party=Conservative |2Colour=#0087DC |2Count1=3500 |2Count2=4500 |2Count3=5500 |3Party=Liberal Democrats |3Colour=#FAA61A |3Count1=2500 |3Count2=2300 |3Count3=2100 }}
Produces...
Graphs are unavailable due to technical issues. There is more info on Phabricator and on MediaWiki.org. |
Troubleshooting
[edit]- A party is listed twice in the key
- Make sure the party's name is spelt correctly, and that the colours are identical.
- The "non-transferable votes" bar is in a colour other than black
- Make sure the number of candidates is correct in the "Candidates" parameter.
- I want to make a graph for an election that has more that 20 candidates, or more than 15 counts
- Leave a message on the template's talk page, or add some extra parameters yourself. Be sure to test your edits in the sandbox before making any major changes.
- I get a "syntax error" message when I use the template
- Make sure there are no thousands separators, transcluded templates or duplicated parameters.