3,060
edits
(edit TemplateData) |
Metriximor (talk | contribs) m (60 revisions imported from wikipedia:Template:Composition_bar/doc) |
||
(17 intermediate revisions by 9 users not shown) | |||
Line 1:
{{Documentation subpage}}
<!-- Add categories where indicated at the bottom of this page and interwikis at 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 ==
; amount
▲:<code><nowiki>{{</nowiki>Composition bar|''amount''|''total''|''bar-color''|color=''color''|background-color=''background-color''|per=0/1<nowiki>}}</nowiki></code>
; total
; 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:
▲* ''amount'' is the number of sub-units
; background-color=...
▲* ''total'' is the total number of sub-units possible
; border=...
; width=...
; 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 27 ⟶ 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 42 ⟶ 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 59 ⟶ 67:
<templatedata>
{
"description": "A composition bar.",
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": "#
"type": "string/line",
"required": false,
},
"
"label": "Background color",
"description": "The
"default": "
"type": "string/line",
"required": false
},
"
"label": "
"description": "The
"default": "#
"type": "string/line",
"required": false,
},
"
"label": "
"description": "The width of the bar
"default": "100px",
"type": "string/line",
"required": false
},
"
"label": "
"description": "When set to 1 (true), adds a percentage to the bar as well
"default": "0",
▲ "default": "1px",
▲ "label": "border-color",
"type": "string/line",
"required": false
Line 126 ⟶ 121:
}
}
</templatedata>
Line 136 ⟶ 130:
<includeonly>{{When on basepage
| <!--
[[Category:Chart, diagram and graph templates]]
[[Category:Wikipedia progress templates]]
|