Charts — Options

Recharts, 4 analytics charts, one central CHART_COLORS map. Two real bugs found; the question is the series-color policy.

The bug, rendered

Outcome-mix stacked bar: “completed” uses --accent = the same blue as primary.

TODAY — completed ≈ brand blue (clashes with primary elsewhere)

FIXED — completed gets a distinct violet

active
replied
won
lost
completed (fixed)
Validator evidence (not eyeballed)

Palette run through a CVD/contrast validator on the light surface.

  • [PASS] Lightness band — all 5 inside L 0.43–0.77
  • [PASS] CVD separation — worst pair red↔green ΔE 12.7 (deutan), above the 12 floor
  • [WARN] Contrast — amber & green < 3:1 vs surface → relief required
  • [INFO] Gray “active” flagged low-chroma — intentional neutral mass
  • • Relief is satisfied: analytics ships a full table view + mobile cards
  • • Red↔green pair keeps its gap spacers (stacked segments have 2px gaps)
Option A — Semantic-status series ✓ CHOSEN

Outcome series use status tokens (they ARE statuses); single-series metric charts use primary. Fix completed → violet, delete dead tokens.

  • • Chart colors mean the same as badges — one vocabulary
  • • Codifies the existing CHART_COLORS map, fixes its 2 bugs
  • • Validator-checked; table view = contrast relief
Option B — Dedicated categorical palette

Repurpose --chart-1..5 with a validated Wong-style palette for all series.

  • • Maximum series separability
  • • Breaks the status↔color vocabulary (won would stop being green)
  • • Right move only when charts outgrow status semantics
Option C — Leave as-is

No changes.

  • • Zero work
  • • Keeps the completed/primary blue clash
  • • Keeps 5 dead tokens misleading future devs
Show audit of the app before this rule
Audit — what we have today
  • ✓ One library (recharts), 4 charts, all analytics
  • ✓ Central CHART_COLORS map — already semantic (won=success, lost=destructive)
  • ✓ Chart height tokens (--chart-h-sm/md/lg); grid/axes use border/muted tokens
  • ✓ Tooltips on all 4; legend on the multi-series chart
  • ✗ “completed” = --accent = SAME blue as primary (series clash)
  • ✗ --chart-1..5 tokens defined but used ZERO times (shadcn leftovers)
  • ✗ Palette was never CVD-validated (now it is — see evidence)
Shared rules (all options)
  • • One axis — never dual-axis; two measures = two charts
  • • Color follows the entity, never its rank; hues assigned fixed, never cycled
  • • ≥2 series → legend; text wears text tokens, never series color
  • • Every chart ships a tooltip + a table fallback (contrast relief)
  • • Max 6–8 categorical series; beyond → “Other” or small multiples
  • • Validate any new palette with the CVD script — never eyeball
Show research sources
Decision: Option A
  • 1. The series ARE statuses. Won/lost/replied in a chart should mean exactly what they mean on a badge — one color vocabulary across the app.
  • 2. B rejected for now: a dedicated categorical palette breaks the badge↔chart vocabulary; it becomes right only when charts need >6 non-status series.
  • 3. Validator-backed: CVD ΔE 12.7 (pass) with gap spacers; amber/green contrast relief = the table view that already ships with analytics.
  • Applied at adoption: completed → new --chart-completed violet (was --accent = primary blue clash); single-series charts unified on primary; dead --chart-1..5 tokens deleted.