(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: | <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 - | {{#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; | <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:orange; height: | <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.
Parameter | Description | Type | Status | |
---|---|---|---|---|
1st value | 1 | The first value. | Number | required |
2nd value | 2 | The second value. | Number | required |
Show total switch | show_total | Use with any input to show the total of the two values. | String | optional |