{# _throughput_overlay.html — Throughput trend overlay chart (Task F3). Renders current-period bars (solid accent) overlaid with previous-period ghost bars (accent-subtle), plus a legend showing totals and delta. Expected context: trend_throughput_overlay — { current: [{bucket, count}, ...], previous: [{bucket, count}, ...], current_total: int, previous_total: int, delta_pct: float | None, } since_days — int, for subtitle throughput_bucket — "day" or "week", used to label the x-axis #} {%- set ov = trend_throughput_overlay -%} {%- set n = ov.current | length -%} {%- set max_count = namespace(val=1) -%} {%- for b in ov.current %} {%- if b.count > max_count.val %}{%- set max_count.val = b.count %}{%- endif %} {%- endfor %} {%- for b in ov.previous %} {%- if b.count > max_count.val %}{%- set max_count.val = b.count %}{%- endif %} {%- endfor %} {%- set has_current = ov.current_total > 0 or ov.previous_total > 0 -%}
Throughput Trend {%- if throughput_bucket == "week" %}weekly buckets · {%- else %}daily buckets · {%- endif %} last {{ since_days }}d vs previous {{ since_days }}d
{%- if not has_current %}
No completed tickets to show a trend.
{%- else %}
{# Previous-period ghost bars (render first, behind current) #} {%- for b in ov.previous %} {%- set bar_h = (b.count / max_count.val * 36) | round(2) %} {%- set bar_y = 40 - bar_h %} Prev {{ b.bucket }}: {{ b.count }} completed {%- endfor %} {# Current-period bars (solid, rendered on top) #} {%- for b in ov.current %} {%- set bar_h = (b.count / max_count.val * 36) | round(2) %} {%- set bar_y = 40 - bar_h %} {{ b.bucket }}: {{ b.count }} completed {%- endfor %} {# X-axis labels: first / mid / last bucket of current period #}
{%- for b in ov.current %} {%- if loop.index0 == 0 or loop.index0 == (n // 2) or loop.index0 == n - 1 %} {{ b.bucket[5:] }} {%- endif %} {%- endfor %}
{# Legend: current vs previous with delta arrow #}
Current {{ ov.current_total }} Previous {{ ov.previous_total }} {%- if ov.delta_pct is not none %} {%- set is_up = ov.delta_pct > 1.0 %} {%- set is_down = ov.delta_pct < -1.0 %} {%- if is_up %}↑{%- elif is_down %}↓{%- else %}→{%- endif %} {{ ov.delta_pct | abs | round(1) }}% {%- endif %}
{%- endif %}