×
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

(will edit this immediately after saving)
 
(better design)
Line 1: Line 1:
<div style="width:100%; display:flex; flex-wrap:wrap; flex-direction:row;">
<div style="width:100%; display:flex; flex-wrap:wrap; flex-direction:row;">
<div style="flex-basis:50%">{{{1|46}}} ({{#expr: floor(({{{1|46}}} / ({{{1|46}}} + {{{2|154}}})) * 100) }}%)</div>
<div style="flex-basis:{{#if:{{{show_total|}}}|33|50}}%">{{{1|46}}} ({{#expr: ({{{1|46}}} / ({{{1|46}}} + {{{2|154}}})) * 100 round 0 }}%)</div>
<div style="flex-basis:50%; text-align:right;">{{{2|154}}} ({{#expr: 100 - floor(({{{1|46}}} / ({{{1|46}}} + {{{2|154}}})) * 100) }}%)</div>
{{#if:{{{show_total|}}}|<div style="flex-basis:34%; text-align:center">Total: {{#expr: {{{1|46}}} + {{{2|154}}} }}</div>}}
<div style="background-color:green; height:4em; border:1px black solid; box-sizing:border-box; width:{{#expr: floor(({{{1|46}}} / ({{{1|46}}} + {{{2|154}}})) * 100) }}%;">
<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>
<div style="background-color:green; width:100%; height:4em; border:1px black solid; box-sizing:border-box;>
<div style="background-color:orange; height:4em; border:1px black solid; border-left:none; box-sizing:border-box; width:{{#expr: 100 - floor(({{{1|46}}} / ({{{1|46}}} + {{{2|154}}})) * 100) }}%">
<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>
</div></div>
</div><noinclude>
</div><noinclude>
<templatedata>
{
"description": "Compares two values. The percentages are of the total.",
"format": "inline",
"params": {
"1": {
"label": "1st value",
"type": "number",
"description": "The first value.",
"required": true
},
"2": {
"label": "2nd value",
"type": "number",
"description": "The second value.",
"required": true
},
"show_total": {
"label": "Show total switch",
"type": "string",
"description": "Use with any input to show the total of the two values."
}
}
}
</templatedata>


[[Category:Templates]]
[[Category:Templates]]
</noinclude>
</noinclude>

Revision as of 20:22, 11 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
Show total switchshow_total

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

Stringoptional