Template:Bar box/doc

Category:Template documentation#Bar%20box/doc

Used for construction of horizontal bar charts.

Usage


{{Bar box
 |width    =
 |barwidth =
 |float    =
 |title    =
 |titlebar =
 |left1    =
 |left2    =
 |right1   =
 |right2   =
 |bars     =
 |caption  =
}}

Bar box scheme
⇤---------------------------------------- width ----------------------------------------⇥
background color=titlebar

title
left1 left2 ⇤--- barwidth ---⇥ right1 right2
or
left1⇤--- barwidth ---⇥ right1
bars
caption

Template parameters

<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData

TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.


Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either ‎useTemplateData=1 or ‎useTemplateData=only on the ‎/doc subpage and transcluding it with {{Documentation}} into the template. <nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw <templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.


Wikipedia's help about TemplateDataCommons-specific information

Category:TemplateData documentation

Used for construction of horizontal bar charts.

Template parameters

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
barsbars

any number of whether "Template:Bar percent" or "Template:Bar pixel"

Contentrequired
barwidthbarwidth

width of the bar area in px

Default
100
Numberoptional
captioncaption

caption under the chart

Contentoptional
floatfloat

side to which the graph is moved (none/left/right)

Suggested values
none left right
Default
none
Lineoptional
first left column header textleft1

content of first left column header

Contentoptional
second left column header textleft2

content of second left column header

Contentoptional
first right column header textright1

content of first right column header

Contentoptional
second right column header textright2

content of second right column header

Contentoptional
stylestyle

additional CSS styles for the whole table

Contentoptional
titletitle

title of the chart

Contentoptional
titlebar colortitlebar

background color of the title (i.e. red, #00FF00, rgb(0, 0, 255))

Default
none
Lineoptional
widthwidth

width of the graph in px

Default
none
Numberoptional

Additional information

The template is intended to be used in the following namespaces: all namespaces

The template is intended to be used by the following user groups: all users

Relies on:

Example

{{Bar box|title    =Beer consumption 🍺
|width    =500
|barwidth =500
|float    =right
|titlebar =lightskyblue
|left1    =Country
|left2    =left2
|right1   =right1
|right2   =in numbers
|bars     =
{{bar pixel|{{W|Germany||en}}|red|120| litres}}
{{bar pixel|USA<sup>{{W|United States of America|1|en}}</sup>|silver|73| this text is invisible|in plastic cups}}
{{bar percent|Czech|#FF8822|51}}
{{bar percent|Denmark|lightskyblue|13|in glasses}}
|caption  =All numbers are estimated
}}

renders as:

Beer consumption 🍺
Country left2 right1 in numbers
Germany
 
120 litres
USA1
 
in plastic cups
Czech
 
51%
Denmark
 
in glasses
All numbers are estimated

Localization

This template is not intended to be localized.

Category:TemplateData documentation Category:Template documentation