{# shared pieces of the app overviews #} {% macro short(v) -%}{% set u = v / 1000 %}{{ ('%gM'|format((u / 1000000)|round(1))) if u|abs >= 1000000 else ('%gk'|format((u / 1000)|round(1))) if u|abs >= 1000 else '%g'|format(u|round(0)) }}{%- endmacro %} {% macro month_bars(months, series, peak, scale, currency, l1, l2=None) %}
{% for v in scale %}
{{ short(v) }}
{% endfor %}
{% for m in months %}{% set v = series[m] %}
{% if l2 %}
{% endif %}
{{ m[5:] }}/{{ m[2:4] }}
{% endfor %}
{% endmacro %} {% macro change(cur, prev) -%} {%- if prev -%}{% set pct = (cur - prev) / (prev if prev > 0 else -prev) * 100 %} {{ '▲' if pct >= 0 else '▼' }} {{ '%.1f'|format(pct|abs) }}%{{ t('vs last month') }} {%- else -%}{{ t('This month') }}{%- endif -%} {%- endmacro %}