---
id: w8/m6/t005
title: Trend view over the last N months
worker: worker8
status: todo
estimate: 40m
depends_on: [w8/m6/t004]
---

## Objective

Add a small trend view (last N months' totals per meter) to the Usage page, reusing the existing chart component from the metrics feature rather than building a new one.

## Context

- `dashboard/src/features/metrics/components/svg-line-chart.tsx` is the existing, reusable line-chart component (already used by `application-metrics-card.tsx`).
- Needs N sequential `useUsage`/`period` calls (or a batched query) — decide the simplest approach given `usage`'s current per-period shape.

## Steps

1. Fetch the last N (e.g. 6) months of usage totals per meter.
2. Render a compact trend chart per meter using `svg-line-chart.tsx`.
3. Handle the empty/sparse-history case (fewer than N months of real data) gracefully.

## Files

- `dashboard/src/features/usage/components/usage-page.tsx`
- `dashboard/src/features/usage/hooks/use-usage.ts`

## Acceptance criteria

- [ ] The Usage page shows a trend view alongside the current month's tables once more than one month of data exists.
- [ ] With only the current month's data (fresh workspace), the trend view degrades gracefully (no crash, sensible empty/partial state).

## Out of scope

- Configurable N or custom date ranges — a fixed trailing window is enough for this milestone.
