3,060
edits
mNo edit summary |
Metriximor (talk | contribs) m (60 revisions imported from wikipedia:Template:Composition_bar/doc) |
||
(12 intermediate revisions by 6 users not shown) | |||
Line 1:
{{Documentation subpage}}
<!--
{{high-use|
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''|
; amount
: 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 {{
; background-color▼
: (default is very light grey) is the background color of the right part of the bar - a valid [[web colors|web color]].▼
; width▼
; per▼
: (default is false), when set to 1 (true), adds a percentage to the bar as well.▼
Additional display options:
▲; background-color=...
▲: (default is
; 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=...
; 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|red|background-color=#
| {{Composition bar|50|100|red|background-color=#
|-
| style="font-size: 95%"| <code><nowiki>{{Composition bar|50|100|
| {{Composition bar|50|100|
|-▼
| style="font-size: 95%"| <code><nowiki>{{Composition bar|50|100|#99F}}</nowiki></code>▼
| {{Composition bar|50|100|#99F}}▼
|-
| style="font-size: 95%"| <code><nowiki>{{Composition bar|50|100|{{Green Party (UK)/meta/color}}}}</nowiki></code>
Line 46 ⟶ 47:
| {{Composition bar|50|100|rgb(255,255,16)}}
|-
| style="font-size: 95%"| <code><nowiki>{{Composition bar|75|100|#FF0
| {{Composition bar|75|100|#FF0
|-
| style="font-size: 95%"| <code><nowiki>{{Composition bar|40|100|#F00
| {{Composition bar|40|100|#F00
|-
| style="font-size: 95%"| <code><nowiki>{{Composition bar|90|100|#F0F0F0
| {{Composition bar|90|100|#F0F0F0
|-
| style="font-size: 95%"| <code><nowiki>{{Composition bar|90|100|#F0C
| {{Composition bar|90|100|#F0C
▲|-
▲| style="font-size: 95%"| <code><nowiki>{{Composition bar|
|}
Line 81 ⟶ 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": "#
"type": "string/line",
"required": false,
"aliases": ["hex"]
},
"
"label": "
"description": "The background color of the right part of the bar - a valid web color.",
"default": "
"type": "string/line",
"required": false
},
"
"label": "
"description": "The
"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
},
"
"label": "
"description": "When set to 1 (true), adds a percentage to the bar as well
"default": "0",
"type": "string/line",
Line 118 ⟶ 130:
<includeonly>{{When on basepage
| <!-- Categories
[[Category:Chart, diagram and graph templates]]
[[Category:Wikipedia progress templates]]
|