feat: add divergence.bars diverging bar chart island#43
Merged
Conversation
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 betweencategory.bar(compares unsigned groups) andwaterfall.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.baseline/colors/ transform knobs by design — compute the signed value in SQL so the manifest stays declarative.Changes
DivergenceBars+ every registration (both unions, the three span maps) and theislandRequirementsbinding checkDivergenceBarsrenderer + registry; purebucketColor/buildDivergenceBars(unit-tested)islandSkeletonentrybind; regenerated manifest referencecalorie_deltaSQL transform), wired into the page's period filteradding-new-islands— the end-to-end island-add discipline (interface/API design →.describe()copy → file-by-file wiring), in.agents/skillswith the matching.claudesymlinkTesting
pnpm build && typecheck && test && lint && validate:templatesgreen locally; new unit tests cover bucket boundaries and null handling. Verified live in the examples health dashboard.