User:Lokal Profil/swe/bar

From ISFDB
Jump to navigation Jump to search
{{#ifeq: {{{1}}} | 0 | | | style="width: {{#expr:({{{1}}}/{{{2}}})*100 round 1}}%; background-color: #009900; border-radius:4px;" | }} {{#ifeq: {{#expr: {{{1}}} < {{{2}}} }} | 0 | | | style="width: {{#expr:(1-({{{1}}}/{{{2}}}))*100 round 1}}%; background-color: #C8C8C8; border-radius:4px;" | }}

First parameter is the value and the second is the total.

{{#ifeq: 0 | 0 | | | style="width: {{#expr:( 0 / 3 )*100 round 1}}%; background-color: #009900; border-radius:4px;" | }} {{#ifeq: {{#expr: 0 < 3 }} | 0 | | | style="width: {{#expr:(1-( 0 / 3 ))*100 round 1}}%; background-color: #C8C8C8; border-radius:4px;" | }}
{{#ifeq: 1 | 0 | | | style="width: {{#expr:( 1 / 3 )*100 round 1}}%; background-color: #009900; border-radius:4px;" | }} {{#ifeq: {{#expr: 1 < 3 }} | 0 | | | style="width: {{#expr:(1-( 1 / 3 ))*100 round 1}}%; background-color: #C8C8C8; border-radius:4px;" | }}
{{#ifeq: 3 | 0 | | | style="width: {{#expr:( 3 / 3 )*100 round 1}}%; background-color: #009900; border-radius:4px;" | }} {{#ifeq: {{#expr: 3 < 3 }} | 0 | | | style="width: {{#expr:(1-( 3 / 3 ))*100 round 1}}%; background-color: #C8C8C8; border-radius:4px;" | }}
{{#ifeq: 4 | 0 | | | style="width: {{#expr:( 4 / 3 )*100 round 1}}%; background-color: #009900; border-radius:4px;" | }} {{#ifeq: {{#expr: 4 < 3 }} | 0 | | | style="width: {{#expr:(1-( 4 / 3 ))*100 round 1}}%; background-color: #C8C8C8; border-radius:4px;" | }}