Template:Progress Bar/doc

From OpenStreetMap Wiki
Jump to: navigation, search

Description

This template allows you to create a highly customizable progress bar anywhere in a wiki page. Just call it this way:

{{Progress bar
| param1 = value1
| param2 = value2
| etc.
}}

Parameters

Here is the list of accepted parameters and their effect on the progress bar. There are two ways of indicating the value (percentage) represented by the bar. The first method uses the progression parameter, while the second uses the min, max and current parameters. Whatever method you use, you can use the progression-text parameter to display any text on the bar, or use the desc parameter which writes down the percentage represented by the bar before the text contained in this parameter. See examples below.

progression
Indicates the percentage represented by the progression bar.
  • ex: 74.2%
  • default value: 0%
min
Indicates the value of the lower bound of the range represented by this bar.
  • ex: 10
  • default value: 0
  • note: if the progression parameter is used, the min parameter is discarded.
max
Indicates the value of the upper bound of the range represented by this bar.
  • ex: 15
  • default value: 100
  • note: if the progression parameter is used, the max parameter is discarded.
current
Indicates the value of the position into the range represented by this bar. This number must be contained between min and max.
  • ex: 13
  • default value: 0
  • note: if the progression parameter is used, the current parameter is discarded.
progression-text
Indicates the text written on the progression bar. If not specified, the text is determined automatically. See explanations below.
  • ex: People know me
  • default value: 0%
title
Indicates the text displayed in the tooltip. If not specified, the text is determined automatically. See explanations below.
  • ex: People know me
  • default value: 0%
mode
Indicates which of the percentage or the current value is to be displayed on the bar and the tooltip. Used only if the second method is used.
  • specify mode=value to make the text display the value of the current parameter instead of the calculated percentage
  • to get the default behavior, simply don't use this parameter
desc
Indicates the text to be displayed on the bar behind the actual percentage represented by the bar.
  • ex: explored
  • default value: none
  • note: if the progression-text parameter is used, the desc parameter is discarded.
bar-background
Color used as the background of the progression bar.
  • ex: red or #328A9C
  • default value: #AAAAFF
box-background
Color used as the background of the block in which the bar is located.
  • ex: red or #328A9C
  • default value: white
box-border
Style of the border of the block in which the bar is located.
  • ex: 2px dotted red
  • default value: 1px solid black
box-margin
Indicates how far the block in which the bar is located must be from the text around it.
  • ex: 5px
  • default value: 1px
box-padding
Indicates the width of the space between the progression bar and the border of the block around it.
  • ex: 0
  • default value: 1px
box-width
Indicates the width of the block in which the bar is located.
  • ex: 15em
  • default value: 0%
text-color
Color of the text written in the center of the bar.
  • default value: black
text-size
Size of the text written in the center of the bar.
  • default value: small
text-weight
Weight of the text written in the center of the bar.
  • default value: bold

Calculation methods

There are two methods you can use to make your bar represent a progression. The first method is by simply specifying the progression parameter. You tell the percentage and the bar shows it. Simple. The second method can be used when you want to display a bar showing progression through a finite set of values. You give the min, max and current parameters, and the percentage is calculated with the following formula: ((current - min) / (max - min)) * 100. If both methods are used, the first one takes precedence. The examples below show how to use both methods.

How the text displayed on the bar and in the tooltip is determined

The tooltip and the bar are the two "zones" where text is displayed on the progression bar. Each one has its own "master parameter", title for the tooltip and progression-text for the bar. If you provide one of these parameters, you will see the text you entered in the corresponding area. If you skip one of these parameters (or both), the text which is displayed is determined automatically. It consists of the percentage represented by the bar (whether given directly through the first method or calculated through the second) , followed by the content of the desc parameter if specified. However, if you used the second calculation method, then you can force the text to show the content of the current parameter instead of the percentage, by adding the mode=value parameter to your template call. Note: to see the tooltip, just put your mouse over the bar. A little box containing the tooltip text should appear.

Examples

Simple progress bar, using the first method:

{{Progress Bar
| progression = 52.4%
| desc = explored
}}
 
52.4%


Styled progress bar, using the second method:

{{Progress Bar
| min = 10
| max = 15
| current = 13
| mode = value
| desc = maxed titles
| progression-text = [[People Know Me]] (2)
| box-width = 15em
| box-border = 1px dotted black
| bar-background = #99CC66
| text-size = 8pt
}}
 
13 maxed titles


A few combinations of both calculation methods and the desc, progression-text and title parameters:

{{Progress Bar
| min = 10
| max = 15
| current = 13
| desc = maxed titles
| title = People Know Me (2)
| box-width = 15em
| text-size = 8pt
}}
 
60% maxed titles


{{Progress Bar
| min = 10
| max = 15
| current = 13
| desc = maxed titles
| progression-text = People Know Me (2)
| box-width = 15em
| text-size = 8pt
}}
 
60% maxed titles


{{Progress Bar
| min = 10
| max = 15
| current = 13
| mode = value
| desc = maxed titles
| title = People Know Me (2)
| box-width = 15em
| text-size = 8pt
}}
 
13 maxed titles


{{Progress Bar
| min = 10
| max = 15
| current = 13
| mode = value
| desc = maxed titles
| progression-text = People Know Me (2)
| box-width = 15em
| text-size = 8pt
}}
 
13 maxed titles


{{Progress Bar
| progression = 14.7%
| desc = explored
| progression-text = exploration
| box-width = 15em
| text-size = 8pt
}}
 
14.7%


{{Progress Bar
| progression = 14.7%
| desc = explored
| title = exploration
| box-width = 15em
| text-size = 8pt
}}
 
14.7%

Notes

  • Don't put the same value for the bar-background and the box-background parameters, or else you won't see the progression bar!
  • If you want more information regarding authorized values for each parameter, please consult the CSS documentation on the W3C website.
  • Unfortunately, the url css attribute is not supported by mediawiki, so you can't set bar-background=url(path/to/image)

See also

Available languages — Progress Bar
· Afrikaans · Alemannisch · aragonés · asturianu · azərbaycanca · Bahasa Indonesia · Bahasa Melayu · Bân-lâm-gú · Basa Jawa · Baso Minangkabau · bosanski · brezhoneg · català · čeština · dansk · Deutsch · eesti · English · español · Esperanto · estremeñu · euskara · français · Frysk · Gaeilge · Gàidhlig · galego · Hausa · hrvatski · Igbo · interlingua · Interlingue · isiXhosa · isiZulu · íslenska · italiano · Kiswahili · Kreyòl ayisyen · kréyòl gwadloupéyen · Kurdî · latviešu · Lëtzebuergesch · lietuvių · magyar · Malagasy · Malti · Nederlands · Nedersaksies · norsk bokmål · norsk nynorsk · occitan · Oromoo · oʻzbekcha/ўзбекча · Plattdüütsch · polski · português · português do Brasil · română · shqip · slovenčina · slovenščina · Soomaaliga · suomi · svenska · Tiếng Việt · Türkçe · Vahcuengh · vèneto · Wolof · Yorùbá · Zazaki · српски / srpski · беларуская · български · қазақша · македонски · монгол · русский · тоҷикӣ · українська · Ελληνικά · Հայերեն · ქართული · नेपाली · मराठी · हिन्दी · অসমীয়া · বাংলা · ਪੰਜਾਬੀ · ગુજરાતી · ଓଡ଼ିଆ · தமிழ் · తెలుగు · ಕನ್ನಡ · മലയാളം · සිංහල · ไทย · မြန်မာဘာသာ · ລາວ · ភាសាខ្មែរ · ⵜⴰⵎⴰⵣⵉⵖⵜ · አማርኛ · 한국어 · 日本語 · 中文(简体)‎ · 吴语 · 粵語 · 中文(繁體)‎ · ייִדיש · עברית · اردو · العربية · پښتو · سنڌي · فارسی · ދިވެހިބަސް