Template:Composition bar/doc: Difference between revisions

m
60 revisions imported from wikipedia:Template:Composition_bar/doc
(interwiki)
m (60 revisions imported from wikipedia:Template:Composition_bar/doc)
 
(45 intermediate revisions by 23 users not shown)
Line 1:
{{Documentation subpage}}
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata -->
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
{{high-use| 4913 }}
 
This template displays the numeric composition of a thing in terms of its sub-units. For example, it is frequently used as part of {{tl|Infobox political party}} to show the number of seats a given political party holds in a legislature. A single line, flexible width version of this template is available at [[Template:Composition bar compact]]. A textless, single line, flexible width version of this template is available at [[Template:Composition bar textless]].
 
== Usage ==
<nowiki>{{</nowiki>Composition bar|''amount''|''total''|''bar-color''|''options...''}}
 
; amount
:<code><nowiki>{{</nowiki>Infobox political party/seats|''seats_won''|''total_seats''|''color''<nowiki>}}</nowiki></code>
: The first parameter is the number of sub-units.
; total
: The second parameter is the total number of sub-units possible.
; bar-color
: (default is light grey) The third parameter is the background color of the left part of the bar - a valid [[web colors|web color]], which can be specified by name, as a [[hex triplet]] (#rrbbgg), or rgb triplet (rgb(0–255,0–255,0–255)).<br />In the case of political parties, most will have their logo color available in {{tlc|political party/meta/color}} templates.
 
Additional display options:
* ''seats_won'' is the number of seats held by the political party
; background-color=...
* ''total_seats'' is the total number of seats possible
: (default is transparent) is the background color of the right part of the bar - a valid [[web colors|web color]].
* ''color'' is a valid [[web colors|web color]], which can be specified either by name, as a [[hex triplet]] (#rrbbgg), or [[hex triplet]] from most {{tld|political party/meta/color}} templates.
; border=...
: (default is medium grey) is the color of the border, or "none" for no border
; width=...
: (default is 100px) a width value for the bar, such as "100%" or "8em" (unitless numbers are interpreted as px)
; per=...
: (default is false), when set to any value (true), adds a percentage to the bar as well
; ref=...
: (default is blank), may be used to add a reference/citation for the numbers.
 
== Examples ==
 
{|
|-
! Code !! Result
|-
| style="font-size: 95%"| <code><nowiki>{{InfoboxComposition political party/seatsbar|50|100|red}}</nowiki></code>
| {{InfoboxComposition political party/seatsbar|50|100|red}}
|-
| style="font-size: 95%"| <code><nowiki>{{InfoboxComposition political party/seatsbar|50|100|red|background-color=#9999FFDDD|border=none}}</nowiki></code>
| {{Composition bar|50|100|red|background-color=#DDD|border=none}}
| {{Infobox political party/seats|50|100|#9999FF}}
|-
| style="font-size: 95%"| <code><nowiki>{{InfoboxComposition political party/seatsbar|50|100|{{Green Party (UK)/meta/color}}#99F|width=85%}}</nowiki></code>
| {{Composition bar|50|100|#99F|width=85%}}
| {{Infobox political party/seats|50|100|{{Green Party (UK)/meta/color}}}}
|-
| style="font-size: 95%"| <code><nowiki>{{InfoboxComposition political party/seatsbar|50|100|rgb{{Green Party (255,255,16UK)/meta/color}}}}</nowiki></code>
| {{Composition bar|50|100|{{Green Party (UK)/meta/color}}}}
| {{Infobox political party/seats|50|100|rgb(255,255,16)}}
|-
| style="font-size: 95%"| <code><nowiki>{{Composition bar|50|100|rgb(255,255,16)}}</nowiki></code>
| {{Composition bar|50|100|rgb(255,255,16)}}
|-
| style="font-size: 95%"| <code><nowiki>{{Composition bar|75|100|#FF0}}</nowiki></code>
| {{Composition bar|75|100|#FF0}}
|-
| style="font-size: 95%"| <code><nowiki>{{Composition bar|40|100|#F00|per=1}}</nowiki></code>
| {{Composition bar|40|100|#F00|per=1}}
|-
| style="font-size: 95%"| <code><nowiki>{{Composition bar|90|100|#F0F0F0|per=1|background-color=#F00}}</nowiki></code>
| {{Composition bar|90|100|#F0F0F0|per=1|background-color=#F00}}
|-
| style="font-size: 95%"| <code><nowiki>{{Composition bar|90|100|#F0C|per=1}}</nowiki></code>
| {{Composition bar|90|100|#F0C|per=1}}
|-
| style="font-size: 95%"| <code><nowiki>{{Composition bar|0|26|hex=#00BFFF|per=1}}</nowiki></code>
| {{Composition bar|0|26|hex=#00BFFF|per=1}}
|}
 
== TemplateData ==
{{TemplateDataHeader}}
 
<templatedata>
{
"description": "A composition bar.",
"params": {
"1": {
"label": "1",
"description": "The number of sub-units.",
"type": "string/line",
"required": true
},
"2": {
"label": "2",
"description": "The total number of sub-units possible.",
"type": "string/line",
"required": true
},
"3": {
"label": "3",
"description": "The background color of the left part of the bar - a valid web color, which can be specified by name, as a hex triplet (#rrbbgg), or rgb triplet (rgb(0–255,0–255,0–255)). In the case of political parties, most will have their logo color available in {{political party/meta/color}} templates.",
"default": "#CCCCCC",
"type": "string/line",
"required": false,
"aliases": ["hex"]
},
"background-color": {
"label": "Background color",
"description": "The background color of the right part of the bar - a valid web color.",
"default": "transparent",
"type": "string/line",
"required": false
},
"border": {
"label": "Border color",
"description": "The color of the border, or 'none' for no border",
"default": "#AAAAAA",
"type": "string/line",
"required": false,
"aliases": ["border-color"]
},
"width": {
"label": "Width",
"description": "The width of the bar with units, such as 100% or 10em (unitless numbers are interpreted as px)",
"default": "100px",
"type": "string/line",
"required": false
},
"per": {
"label": "Show percent",
"description": "When set to 1 (true), adds a percentage to the bar as well",
"default": "0",
"type": "string/line",
"required": false
}
}
}
</templatedata>
 
== See also ==
* {{tl|Infobox political partyBartable}}
* {{tl|Bar graphchart}}
 
{{Progress templates}}
<includeonly>
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
[[Category:Template implementation details]]
[[Category:Graphic templates]]
 
<includeonly>{{When on basepage
[[cs:Šablona:Infobox politická strana/mandáty]]
| <!-- Categories below this line; interwikis at Wikidata -->
[[de:Vorlage:Infobox Partei/Mandate]]
[[Category:Chart, diagram and graph templates]]
[[es:Plantilla:Ficha de partido político/escaños]]
[[Category:Wikipedia progress templates]]
[[id:Templat:Infobox partai politik/kursi]]
}}</includeonly>
[[ja:Template:政党/議席数]]
[[sv:Mall:Partifakta/platser]]
</includeonly>