Skip to content

feat(ui): KPI, heatmap, combo chart kinds (DASH-5)#149

Merged
eliotlim merged 2 commits into
mainfrom
feat/dash-5-viz-kinds
Jul 13, 2026
Merged

feat(ui): KPI, heatmap, combo chart kinds (DASH-5)#149
eliotlim merged 2 commits into
mainfrom
feat/dash-5-viz-kinds

Conversation

@eliotlim

Copy link
Copy Markdown
Owner

What

Three new built-in chart kinds added register-only via registerChartKind, proving the DASH-1 registry. Board: DASH-5 (Epic: Dashboards).

  • kpi — single-figure metric tile (scalar / summed series / {figure,target} object) in the MetricCard look: caption, big tabular figure, "82% of 100" + progress bar. The figure is a <Mark> (hover + keyboard).
  • heatmap — rows×cols grid (flat multi-series OR the matrix channel); single-hue fill-opacity intensity over palette[0] (on-theme); each cell a <Mark> with in-cell value + labels.
  • combo — first series as bars, remaining as overlaid lines on a shared axis (flat multi-series or matrix); bars + line points are <Mark>s; degrades to a plain bar with one series.

Zero edits to the render/slash/selector dispatch, exportBlocks.ts, toHtml.ts, databaseCharts.tsx, or chartSvg.ts — they appear automatically in the Kind selector + Change-kind menu.

Export switch (the DASH-1 carry-over — handled)

Added kpi/heatmap/combo branches to the separate drawKit runtime in packages/ui/src/export/kitChart.ts (with JS twins kept in sync), so each kind exports (interactive HTML + PDF, which prints that HTML). Proof: new kitChartKinds.test.ts runs the export renderer and asserts real SVG per kind (+ empty→''). Each kind encodes into the flat {value,labels} shape the export sees (no matrix), matching what both source modes produce.

Both data sources

Each kind renders from a reactive expression AND a DB source (via the matrix channel where applicable).

Tests / verify

chartsInteractive.test.tsx extended (heatmap/combo per-kind table + a KPI describe + no-context/export-path assertions); new kitChartKinds.test.ts. build:libs+typecheck(6)+lint(6)+unit (UI 112 files/1037 tests)+test:e2e (server+mcp 43) all green foreground. CSS .obe-chart-kpi-*/.obe-chart-heat-* all token-based.

For the design reviewer

Screenshots (light+dark) of the real export output at /tmp/dash5-shot.png (KPI) + /tmp/dash5-shot2.png (heatmap+combo). Two minor non-blocking notes: combo top-right legend can graze a tall final bar (pre-existing bar/line legend position, unchanged); heatmap in-cell text is --foreground/0.85 (legible across the ramp both themes).

Scope: packages/ui (charts.tsx registrations + kitChart.ts export + index.css + tests).

Register three new built-in kit chart kinds via registerChartKind — no
render/slash/selector dispatch edit — so they appear in the Kind selector
and the Change-kind menu automatically:

- kpi: one large figure reduced from the value (scalar as-is, series sums,
  or a {value, target} object) with the MetricCard look — caption, target
  readout, and progress bar — rendered as SVG so it rides the same pipeline.
- heatmap: a rows×series grid whose cell intensity encodes the value via a
  single-hue fill-opacity ramp over the first palette colour (on-theme,
  recolours with the scheme). Reads flat multi-series or the matrix channel.
- combo: first series as bars, the rest overlaid as lines on one scale.

All three read BOTH data sources (reactive expression + DB source) and wrap
every datum in <Mark> for the shared hover/tooltip/highlight scaffold. The
separate export switch (drawKit in export/kitChart.ts) gains matching kpi/
heatmap/combo branches — proven by unit tests that execute the runtime — so
they export faithfully in interactive HTML and PDF, not just in-editor.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KFk2T9k3p7ghCjdzMfkA5w
@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app.book.pub Ready Ready Preview, Comment Jul 13, 2026 12:16pm

Request Review

…iew)

Two review nits on the DASH-5 chart kinds:

- Heatmap cell labels washed out in dark mode: a high-intensity cell is a
  near-opaque pale fill in BOTH themes, so the theme foreground ink went
  light-on-light in dark mode. Choose the ink by INTENSITY, not theme — above
  0.6 the label uses a fixed dark ink (#233246), else the foreground — so the
  number contrasts its cell regardless of theme. Applied in both the editor
  (Heatmap + .obe-chart-heat-label-strong) and the export runtime (heatmap
  branch), kept in sync via the same 0.6 threshold.
- Combo legend drew a square swatch for the line ("Target") series. SeriesLegend
  now takes a per-series glyph selector (default square, so bar is unchanged);
  line/area pass 'line' and combo passes bar-then-line, giving line series a
  rule glyph. Mirrored in the export legend block.

Editor + export stay in sync; unit tests assert the strong-ink threshold split
and the bar-vs-line legend glyphs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KFk2T9k3p7ghCjdzMfkA5w
@eliotlim eliotlim merged commit 95df5e8 into main Jul 13, 2026
10 checks passed
@eliotlim eliotlim deleted the feat/dash-5-viz-kinds branch July 13, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant