{# Cost-trend line chart. Reused by: - templates/jobs/cohort.html - full cohort view at /jobs/{table} - templates/opportunities/detail.html - embedded for context - templates/failures/detail.html - embedded for context Caller sets: - chart_points_payload : list[dict] (from cohort_view.build_chart_points_payload or JobCohortView.chart_points_payload()). REQUIRED. - chart_title : str (defaults to "Cost trend") - chart_subtitle : str (default explains skipped-days) - chart_history_href : str (optional; renders a "View full history" link in the header when set) X axis (spec 162): one tick per EXECUTION (label "YYYY-MM-DD HH:MM"), so a query run 18× in a day shows as 18 dots. For tables above ``_PER_EXECUTION_CAP`` executions it falls back to one tick per UTC day (label "YYYY-MM-DD"); ``granularity`` in each point says which. Y axis: USD cost - per execution, or summed over the day in fallback mode. Markers: a contrasting scatter point overlays the FIRST occurrence of each query_hash (i.e., a version transition starts here). Click handler: navigates to /jobs/{first_job_id}?from=cohort (the exact execution for per-execution points; the day's first run in fallback). Mirrors the dashboard's _trend_chart.html ECharts/ChartUtils setup so the colours / axis styling stay consistent with the rest of the audit. The chart is always rendered fully expanded; the previous ``chart_collapsible`` flag has been removed because the trend is small enough not to dominate the page and was burying the data behind an unnecessary click. #} {% set _chart_title = chart_title | default("Cost trend") %} {% set _gran = (chart_points_payload[0].granularity if chart_points_payload else "execution") %} {% set _chart_subtitle = chart_subtitle | default( "One point per execution." if _gran == "execution" else "One point per day (high-frequency table; executions rolled up daily). Days without executions are skipped." ) %}
No executions in the current scan window.