{% macro sparklineEvolution(evolution) %} {% set evolutionPretty = evolution.percent %} {% set compareValue = evolution.trend is defined ? evolution.trend : evolution.percent %} {% if compareValue < 0 %} {% set evolutionClass = 'negative-evolution' %} {% set evolutionIcon = 'arrow_down.png' %} {% elseif compareValue == 0 or compareValue == '0%' %} {% set evolutionClass = 'neutral-evolution' %} {% set evolutionIcon = 'stop.png' %} {% else %} {% set evolutionClass = 'positive-evolution' %} {% set evolutionIcon = 'arrow_up.png' %} {% set evolutionPretty = '+' ~ evolution.percent %} {% endif %} {% endmacro %} {% macro singleSparkline(sparkline, allMetricsDocumentation, areSparklinesLinkable) %}
{% if sparkline.title|default is not empty %}
{{ sparkline.title }}
{% endif %} {% if sparkline.url %}{{ sparkline(sparkline.url)|raw }}{% endif %}
{% for groupName, group in sparkline.metrics %} {% if groupName is not empty %}{{ groupName }}{% endif %} {% for metric in group %} {% if '%s' in metric.description -%} {{ metric.description|translate(""~metric.value|number(2)~"")|raw }} {%- else %} {{ metric.value|number(2) }} {{ metric.description }} {%- endif %}{% if not loop.last %}, {% endif %} {% if metric.evolution is defined %} {{ _self.sparklineEvolution(metric.evolution) }} {% endif %} {% endfor %} {% endfor %} {% if sparkline.evolution is defined %} {{ _self.sparklineEvolution(sparkline.evolution) }} {% endif %}
{% endmacro %}