Template:Progress bar: Difference between revisions
From Lie of Wiki
({{large}}) |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 7: | Line 7: | ||
| <p> | | <p> | ||
{{Large|1= | {{Large|1= | ||
'''{{#expr: ( {{{1|<noinclude>2</noinclude>0}}} / {{{total|100}}}) * 100 round {{{decimal|1}}}}}%''' | '''{{#expr: ({{{1|<noinclude>2</noinclude>0}}} / {{{total|100}}}) * 100 round {{{decimal|1}}}}}%''' | ||
}} | }} | ||
{{{text|completed <small>(estimate)</small>}}} | {{{text|completed <small>(estimate)</small>}}} | ||
Line 14: | Line 14: | ||
<p style="border:{{{border|1px solid #c8ccd1}}}; padding:{{{padding|1px}}}; overflow:hidden;"> | <p style="border:{{{border|1px solid #c8ccd1}}}; padding:{{{padding|1px}}}; overflow:hidden;"> | ||
<span style=" <!-- if percentage is higher than 100%, show all green bar --> | <span style=" <!-- if percentage is higher than 100%, show all green bar --> | ||
width: {{#ifexpr: | width: {{#ifexpr: ({{{1|0}}}/{{{total|100}}})>1 | 100 | {{#expr: {{{1|<noinclude>2</noinclude>0}}} / {{{total|100}}} * 100}}}}%; | ||
height: {{{height|2}}}px; | height: {{{height|2}}}px; | ||
background:{{{color1|#00af32}}}; | background:{{{color1|#00af32}}}; | ||
Line 20: | Line 20: | ||
"> </span> | "> </span> | ||
<span style=" <!-- if percentage is higher than 100%, show no grey bar --> | <span style=" <!-- if percentage is higher than 100%, show no grey bar --> | ||
width: {{#ifexpr: | width: {{#ifexpr: ({{{1|0}}}/{{{total|100}}})>1 | 0 | {{#expr: 100 - {{{1|<noinclude>2</noinclude>0}}} / {{{total|100}}} * 100}}}}%; | ||
height: {{{height|2}}}px; | height: {{{height|2}}}px; | ||
background:{{{color2|#eaecf0}}}; | background:{{{color2|#eaecf0}}}; |
Latest revision as of 19:56, 19 January 2024
20% completed (estimate)
File:Test Template Info-Icon - Version (2).svg Template documentation[view] [edit] [history] [purge]
File:Ambox warning yellow.svg | This template employs intricate features of template syntax.
You are encouraged to familiarise yourself with its setup and parser functions before editing the template. If your edit causes unexpected problems, please undo it quickly, as this template may appear on a large number of pages. You can conduct experiments, and should test all major changes, in either this template's sandbox, the general template sandbox, or your user space before changing anything here. |
Usage
{{Progress bar|value}}
This template draws a progress bar. By default, the value
to supply as the parameter is the percent, from 0 to 100 (e.g. 1 would mean 1%, .1 would be 0.1%). If a value isn't specified or is invalid, the bar displays 0%. Values greater than 100% will display incorrectly, although the text label will be correct.
Optional parameters
height
= height of the progress bar in pixels; defaults to 2width
= width of the progress bar; defaults to 75%text
= message to display after %; defaults to: completed (estimate)total
= amount to use as the denominator (instead of 100), allows the template to compute the percentage on the flyheader
= no (or any value other than "yes", which is the default) suppresses the display of the percentage on the top linecolor1
= the colour of the filled portion of the progress barcolor2
= the colour of the background of the progress bardecimal
= the number of decimal places to round to; defaults to 1
Examples
Default configuration
{{Progress bar|5}}
:
5% completed (estimate)
With custom header text
{{Progress bar|5|text=done}}
:
5% done
Without header text
{{Progress bar|80|header=no|text=does not display here}}
:
Custom height and width
{{Progress bar|80|height=4|width=50%}}
:
80% completed (estimate)
Custom total
{{Progress bar|5|total=5}}
:
100% completed (estimate)