{% load add_to_qs %} {% if event_sparkline %} {% for sparkline_variant in event_sparkline.variants %} {% if not event_sparkline_interval_hours or sparkline_variant.interval_hours == event_sparkline_interval_hours %}
{# y-axis #}
{# basic idea: first and last are half-cells, middle are full-width; this way the outermost labels are aligned with the outsides #} {% for y_label in sparkline_variant.y_labels %} {% if forloop.first %} {#-- top half-cell #}
{{ y_label }}
{% elif forloop.last %} {# bottom half-cell #}
{{ y_label }}
{% else %} {# full-width middle cells #}
{{ y_label }}
{% endif %} {% endfor %}
{# Chart area #}
{# bars #}
{% for bucket in sparkline_variant.event_buckets %} {% if event_sparkline_clickable and bucket.click_count and bucket.digest_order %} {% include "events/_event_sparkline_bucket.html" with clickable=True %} {% else %}
{% include "events/_event_sparkline_bucket.html" %}
{% endif %} {% endfor %}
{# baseline directly under bars #}
{# x-axis #}
{# basic idea: as the y-axis, but without the float-out #} {% for x_label in sparkline_variant.x_labels %} {% if forloop.first %}
{{ x_label|date:"j M" }}
{% elif forloop.last %}
{{ x_label|date:"j M" }}
{% else %}
{{ x_label|date:"j M" }}
{% endif %} {% endfor %}
{# bottom-left stays empty #}
{% endif %} {% endfor %} {% endif %}