{# _cycle_dist.html — Cycle-time distribution histogram (Task F3). Expected context: cycle_dist — result of cycle_time_distribution(): {min, max, p50, p75, p95, bins: [{lo, hi, count}, ...], count (added by shaper)} since_days — int, for subtitle #} {%- set cd = cycle_dist -%} {%- set has_data = cd.bins | length > 0 -%}
Cycle Distribution histogram · creation → done
{%- if not has_data %}
No completed tickets in this window.
{%- else %} {# ── Histogram SVG ── #} {%- set n_bins = cd.bins | length %} {%- set svg_w = n_bins * 12 %} {%- set svg_h = 64 %} {%- set bar_w = 10 %} {%- set gap = 2 %} {%- set max_count = namespace(val=1) %} {%- for b in cd.bins %} {%- if b.count > max_count.val %} {%- set max_count.val = b.count %} {%- endif %} {%- endfor %}
{%- for b in cd.bins %} {%- set bar_h = (b.count / max_count.val * (svg_h - 4)) | round(1) %} {%- set bar_y = svg_h - bar_h %} {%- set bar_x = loop.index0 * (bar_w + gap) %} {%- set is_peak = (b.count == max_count.val) %} {{ b.lo | round(1) }}–{{ b.hi | round(1) }}d: {{ b.count }} ticket{{ "s" if b.count != 1 else "" }} {%- endfor %} {# X-axis: min / mid / max labels #} {%- set mid_val = ((cd.min + cd.max) / 2) | round(1) %}
{{ cd.min | round(1) }}d {{ mid_val }}d {{ cd.max | round(1) }}d
{# ── Percentile chips ── #}
p50 {{ cd.p50 | round(1) }}d p75 {{ cd.p75 | round(1) }}d p95 {{ cd.p95 | round(1) }}d {%- set cd_count = cd.bins | sum(attribute='count') %} n {{ cd_count }}
{%- endif %}