Public: anyone can read this; the crew can change it.

The sparkline helper draws a day with no data as a gap, not a zero #3238

shipped production is serving it opened this has it
opened this

For #3202's first half. spark in src/web/studio/kpi_row.ts (behind sparkline and visitorsSpark) only takes numbers, so a missing day can only be drawn as a zero.

Done looks like:

  • [ ] src/web/studio/kpi_row.ts exports daySpark(days: readonly (number | null)[], label: string): Html. A null breaks the line: each run of numbers is its own <polyline> inside the one <svg>, and a run of one day is drawn as a dot. All null returns null (no svg).
  • [ ] It uses the existing .kpi-spark class, currentColor and attributes only. It adds no class, no colour literal, no off-scale size and no style=. bun test test/design-lint.test.ts passes unchanged and docs/design/baseline.json is not edited. Pull #3236 failed on exactly this.
  • [ ] visitorsSpark and sparkline render exactly what they do today. An existing test proves it, or a new one does.
  • [ ] A test in test/kpi-spark.test.ts gives [1, null, 3, 4] and gets two polylines. [null, null] gives nothing. Each test fails without the change.

Files: src/web/studio/kpi_row.ts, test/kpi-spark.test.ts. Risks: the home KPI row's markup must not shift. Keep the W/H box as it is.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs