Add Charts2 Storybook samples#9
Merged
Merged
Conversation
xrendan
force-pushed
the
codex/charts2-storybook-samples
branch
3 times, most recently
from
June 12, 2026 16:03
df66fa9 to
253a8b9
Compare
xrendan
force-pushed
the
codex/charts2-storybook-samples
branch
from
June 12, 2026 16:30
253a8b9 to
8af4421
Compare
Implements two chart-definition features that previously parsed but did not render (spec 09, spec 02). Faceting (small multiples): - facet: "entity" | "metric" lays out a grid of panels balanced to the frame aspect ratio, with per-panel titles and a 16-panel cap. - Panels share one value domain (two-pass union) so gridlines align, and a shared legend sits above the grid for multi-series facets. Falls back to a single chart when only one panel would result. Comparison lines: - comparisonLines render horizontal (y) and vertical (x/time) reference lines with labels on line and stacked-area charts; out-of-range lines are skipped. Other chart types emit a comparison-lines-unsupported warning instead of dropping the config silently. Chart layers now expose valueDomain for the faceting two-pass. Adds unit tests for both features, Storybook stories (Charts2/Faceting, Charts2/ComparisonLines), and CLI sample definitions.
…e focus Single checkpoint of in-flight work across several streams on this branch: - Theme rework: chrome colours sourced from @buildcanada/colours (linen/charcoal/nickel/auburn); larger title/subtitle fonts; emphasis dimOpacity 0.35 -> 0.2. Corpus goldens re-blessed to match. - New chart types: slope, dumbbell, scatter, marimekko (layouts, goldens, stories, tests) wired into the layout registry. - Interactive chrome rethemed to the Build Canada palette; flush tab row; new @buildcanada/components primitives (Popover, RadioGroup, Select, SegmentedControl, Slider, IconButton). - Line-chart focus: hovering/clicking a series' end label emphasizes it (spec 07 §3), non-focused lines/labels dim to 0.2 and their markers hide; forceable via `charts render --focus <series>` and the Chart `focusedSeries` prop. - CLI: scaffold + install-skill commands. - Adds the charts3 DOM-free engine experiment and the specs/ directory. Stray CLI render artifacts (chart.png/chart.svg) intentionally left untracked.
…book-samples # Conflicts: # package.json
Deletes the packages/charts3 experiment (DOM-free engine slice) and all references: root build:charts3 / build:packages scripts, the workspace lockfile entry, and the spec 28 mention. charts3 was untracked into the tree by the prior WIP checkpoint and is not a dependency of any package.
… tests - ci.yml: run `build:packages` before the typecheck and build jobs (the test job already did), so charts2 can resolve @buildcanada/components — it now imports the primitives after the chrome retheme. - inkWidth.test.ts: skip when the (gitignored) brand TTF is absent instead of hard-throwing, so the rasterization acceptance test doesn't fail CI. - DownloadModal.test.tsx: mark the known-bug reproduction `it.fails()` so it is expected-to-fail rather than breaking CI (re-flags if the bug is fixed).
An orphaned snapshot entry remained in layoutChart.test.ts.snap; vitest under CI=true treats obsolete snapshots as a failure. All 70 matrix assertions already pass — this only removes the dead entry, no fingerprints change.
- formatValue gains prefix/suffix, wired through ColumnMeta, the manifest column schema, and per-column binding overrides. An explicit suffix suppresses auto-abbreviation (the value is already at that scale), so pre-scaled figures render cleanly: en "$192.9B", fr "192,9B $". Negatives and sign preserved. Columns without prefix/suffix are byte-for-byte unchanged. - Annotate the dollar columns in the provincial-budgets, federal-departments and government-debt fixtures with the B/M scale suffix (data not rescaled); denominator-derived "% of GDP" columns left alone. - Re-bless 26 corpus goldens and update the unit tests whose formatted strings shifted (number, DataTable, EntitySelector, dumbbell, marimekko, layoutChart snapshot).
- Axis ticks (verbosity "tick") trim trailing zeros while still respecting the column's decimal cap, so a round tick reads "$50B" not "$50.0B"; integer columns stay whole and genuinely fractional ticks keep their digits. Data labels and tooltips keep their fixed decimals. - A zero value never carries a scale suffix: "$0", never "$0B" — applied on every surface. Re-blessed the corpus and refreshed the layoutChart matrix snapshot; added regression cases in number.test.ts.
Set @buildcanada/colours, components, charts, and charts2 to 0.4.0, and update the inter-package dependency ranges (charts, charts2 → colours, components) to ^0.4.0. Lockfile unchanged: workspace packages resolve by path, so `bun install --frozen-lockfile` stays satisfied.
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.
Summary
Verification
Note: earlier,
bun test src/cli/render.test.tswas run; the existing PNG rasterization smoke test timed out after 5s, while the rest of that file passed.