# Line Trend Chart

Use this template for a compact static-SVG line chart when continuous change over time is the
main story.

`widget-code.html` is a single `<svg>` root — no `<canvas>`, no Chart.js, no `<script>`. Neither
host (minimal-desktop chat, static documents) can execute JavaScript, so every value that used to
appear only on hover is drawn directly on the chart instead.

## Use When

- A single metric changes across ordered time points.
- The reader needs the trend shape, not only the current value.
- The visual can fit in one inline card with one focal point.
- The data has 4-12 points and one primary series.

## Avoid When

- The answer only needs one current number. Use a KPI summary pattern instead.
- Categories need ranking or magnitude comparison. Use `bar-chart-multiple` instead.
- Two or more series are the main story. `needs-static-rewrite` templates aside, keep this
  template single-series; compose two `line-trend` panels stacked vertically instead of forcing
  a second line into one chart.
- There are more than 24 time points. Aggregate or summarize before rendering.

## Data Shape

Illustrative only — when adapting this template, replace both the numbers and the coordinates in
`widget-code.html` together; there is no runtime data-binding layer.

```json
{
  "title": "Line Chart",
  "xDataKey": "month",
  "seriesKey": "desktop",
  "chartData": [
    { "month": "January", "desktop": 186 },
    { "month": "February", "desktop": 305 }
  ]
}
```

## Visual Rules

- Keep one series by default; use `--dui-chart-series-1` for the line and its data dots.
- x-axis labels are abbreviated to three characters (Jan/Feb/Mar…).
- Horizontal grid lines only, drawn with `--dui-border` at full opacity but thin (`stroke-width:1`)
  so repeated lines don't read heavier than a single divider; the zero baseline uses
  `--dui-text-faint` so it doubles as an implicit axis.
- Hide y-axis tick labels unless exact scale reading is required — the per-point value labels
  already give the reader the numbers that matter.
- Every data point is a small brand-filled dot (`fill: --dui-chart-series-1`,
  `stroke: --dui-surface`) so it reads as a discrete point against the line, not just a bend.
- **Every value is a permanent on-chart label**, not a hover tooltip — this replaces the original
  template's Chart.js hover tooltip, which cannot exist in either host.
- Do not add conclusion, recommendation, or analysis copy inside the widget; keep that text in the
  surrounding response.

## Edge Cases

- Missing/non-numeric points: skip that point and its dot/label; do not draw a broken segment
  through a gap — split the line into two `<path>` segments instead.
- If every value is invalid, do not emit this chart at all — fall back to Markdown.
- If labels are long, abbreviate x-axis ticks; keep exact values in the point label instead of a
  tooltip.
- If the chart needs a second series, do not force it into this template — stack two panels, or
  use a fallback primitive with a small legend instead.

## Acceptance Checks

- `widget-code.html`'s only root element is `<svg>`; no `<canvas>`, no `<script>`, no
  `<!DOCTYPE>`/`<html>`/`<head>`/`<body>`.
- Every data value is drawn on the chart, not hidden behind a hover state.
- No two labels/dots overlap (checked by the coordinate math the geometry rules in `SKILL.md`
  require before drawing).
- `templates/manifest.json` marks `line-trend` as `ready`.
