Template:Composition bar/doc: Difference between revisions

m
60 revisions imported from wikipedia:Template:Composition_bar/doc
(updating again, template reverted to 2015 version)
m (60 revisions imported from wikipedia:Template:Composition_bar/doc)
 
(8 intermediate revisions by 5 users not shown)
Line 1:
{{Documentation subpage}}
<!-- CategoriesAdd gocategories where indicated at the bottom of this page, please;and interwikis go to Wikidata (see also:at [[Wikipedia:Wikidata]]) -->
{{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 ==
Line 13:
: 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 {{tldtlc|political party/meta/color}} templates.
 
Additional display options:
; background-color=...
: (default is medium-dark greytransparent) is the background color of the right part of the bar - a valid [[web colors|web color]].
; border=...
: (default is medium grey) is the color of the border, or "none" for no border
; width=...
: (default is 100%100px) is thea width ofvalue 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 ==
Line 31 ⟶ 35:
| {{Composition bar|50|100|red}}
|-
| style="font-size: 95%"| <code><nowiki>{{Composition bar|50|100|pinkred|background-color=#333DDD|border=none}}</nowiki></code>
| {{Composition bar|50|100|pinkred|background-color=#333DDD|border=none}}
|-
| style="font-size: 95%"| <code><nowiki>{{Composition bar|50|100|#99F|width=85%}}</nowiki></code>
| {{Composition bar|50|100|#99F|width=85%}}
|-
| style="font-size: 95%"| <code><nowiki>{{Composition bar|50|100|{{Green Party (UK)/meta/color}}}}</nowiki></code>
Line 54 ⟶ 58:
| 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}}
|}
 
Line 78 ⟶ 85:
"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": "#CCCCCCCCC",
"type": "string/line",
"required": false,
Line 89 ⟶ 96:
"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 inwith pxunits, (fixedsuch widthas only,100% relativeor widths10em do(unitless notnumbers workare interpreted as px)",
"default": "100100px",
"type": "string/line",
"required": false
Line 115 ⟶ 130:
 
<includeonly>{{When on basepage
| <!-- Categories go below this line, please; interwikis go toat Wikidata, thank you! -->
[[Category:Chart, diagram and graph templates]]
[[Category:Wikipedia progress templates]]