×
Create a new article
Write your page title here:
We currently have 3,089 articles on YumeWiki. Type your article name above or click on one of the titles below and start writing!



YumeWiki
3,089Articles

Template:VersusBar: Difference between revisions

(better design)
(half default height, add more options)
 
Line 3: Line 3:
{{#if:{{{show_total|}}}|<div style="flex-basis:34%; text-align:center">Total: {{#expr: {{{1|46}}} + {{{2|154}}} }}</div>}}
{{#if:{{{show_total|}}}|<div style="flex-basis:34%; text-align:center">Total: {{#expr: {{{1|46}}} + {{{2|154}}} }}</div>}}
<div style="flex-basis:{{#if:{{{show_total|}}}|33|50}}%; text-align:right;">{{{2|154}}} ({{#expr: 100 - ({{{1|46}}} / ({{{1|46}}} + {{{2|154}}})) * 100 round 0 }}%)</div>
<div style="flex-basis:{{#if:{{{show_total|}}}|33|50}}%; text-align:right;">{{{2|154}}} ({{#expr: 100 - ({{{1|46}}} / ({{{1|46}}} + {{{2|154}}})) * 100 round 0 }}%)</div>
<div style="background-color:green; width:100%; height:4em; border:1px black solid; box-sizing:border-box;>
<div style="background-color:{{{color2|green}}}; width:100%; height:{{{height|2em}}}; border:1px black solid; box-sizing:border-box;>
<div style="background-color:orange; height:100%; border-right:1px black solid; box-sizing:border-box; width:{{#expr: ({{{1|46}}} / ({{{1|46}}} + {{{2|154}}})) * 100 round 0 }}%">
<div style="background-color:{{{color1|{{{color|orange}}}}}}; height:100%; border-right:1px black solid; box-sizing:border-box; width:{{#expr: ({{{1|46}}} / ({{{1|46}}} + {{{2|154}}})) * 100 round 0 }}%">
</div></div>
</div></div>
</div><noinclude>
</div><noinclude>
Line 23: Line 23:
"description": "The second value.",
"description": "The second value.",
"required": true
"required": true
},
"height": {
"label": "Height",
"type": "string",
"description": "Customise the height of the bar.",
"default": "2em"
},
"color1": {
"label": "1st value color",
"aliases": ["color"],
"type": "string",
"description": "Customise the color of the first value.",
"default": "orange"
},
"color2": {
"label": "2nd value color",
"type": "string",
"description": "Customise the color of the second value.",
"default": "green"
},
},
"show_total": {
"show_total": {

Latest revision as of 00:09, 12 December 2024

46 (23%)
154 (77%)

Compares two values. The percentages are of the total.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
1st value1

The first value.

Numberrequired
2nd value2

The second value.

Numberrequired
Heightheight

Customise the height of the bar.

Default
2em
Stringoptional
1st value colorcolor1 color

Customise the color of the first value.

Default
orange
Stringoptional
2nd value colorcolor2

Customise the color of the second value.

Default
green
Stringoptional
Show total switchshow_total

Use with any input to show the total of the two values.

Stringoptional