Skip to content

feat: add divergence.bars diverging bar chart island#43

Merged
lukaisailovic merged 2 commits into
mainfrom
feat/deviation-bars-island
Jun 26, 2026
Merged

feat: add divergence.bars diverging bar chart island#43
lukaisailovic merged 2 commits into
mainfrom
feat/deviation-bars-island

Conversation

@lukaisailovic

Copy link
Copy Markdown
Owner

What

Adds divergence.bars — a diverging bar chart. One signed bar per category extends up or down from a zero baseline, each bar colored by which value band it falls into. It fills the gap between category.bar (compares unsigned groups) and waterfall.bars (accumulates into a running total): independent signed bars where the up/down direction is the message — calorie surplus/deficit, budget variance, net cash flow, sentiment, temperature anomaly.

Interface

Happy path is one line; everything else is optional with sensible defaults:

{ "type": "divergence.bars", "dataset": "calorie_delta", "x": "date", "value": "delta" }
  • buckets: [{ gte?, lt?, color, label? }] colors each bar by the band its value falls in (matched half-open [gte, lt); labels drive the legend). Omit for a green-positive / red-negative two-tone.
  • No baseline / colors / transform knobs by design — compute the signed value in SQL so the manifest stays declarative.

Changes

  • schema: DivergenceBars + every registration (both unions, the three span maps) and the islandRequirements binding check
  • runtime: lazy DivergenceBars renderer + registry; pure bucketColor / buildDivergenceBars (unit-tested)
  • cli: islandSkeleton entry
  • docs: islands catalog + charts page + a concepts note on filter bind; regenerated manifest reference
  • examples/health: a "Daily calorie delta" chart on the Nutrition page (via a calorie_delta SQL transform), wired into the page's period filter
  • skill: adding-new-islands — the end-to-end island-add discipline (interface/API design → .describe() copy → file-by-file wiring), in .agents/skills with the matching .claude symlink

Testing

pnpm build && typecheck && test && lint && validate:templates green locally; new unit tests cover bucket boundaries and null handling. Verified live in the examples health dashboard.

One signed bar per category diverging up/down from a zero baseline, each bar
colored by the value band it falls in. Interface-first: one-line happy path
({type, dataset, x, value}), optional `buckets` for magnitude coloring,
defaulting to a green/red two-tone. Compute the signed value in SQL so the
manifest stays declarative.

- schema: DivergenceBars + registrations (unions, span maps) + islandRequirements
- runtime: lazy DivergenceBars renderer + registry; pure bucketColor/buildDivergenceBars
- cli: islandSkeleton entry
- docs: islands catalog + charts page + concepts (filter bind note), regenerated reference
- examples/health: "Daily calorie delta" on the Nutrition page (SQL transform)
- skill: adding-new-islands — island-add design discipline + wiring (.agents/skills + .claude symlink)
@lukaisailovic lukaisailovic merged commit f7c900f into main Jun 26, 2026
2 checks passed
@lukaisailovic lukaisailovic deleted the feat/deviation-bars-island branch June 26, 2026 19:15
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