Statistical And Financial Interval Pass
Date: 2026-05-11
Scope And Context
The request was to take the most useful remaining items from compiler-gap-analysis.md, keep that document current, update the compiler gallery pages, and add missing Data Visualisation Catalogue charts that depend on the new compiler pieces.
This pass stayed inside the Cartesian compiler surface: raw table transforms, numeric/band/ordinal scales, generated guides, and existing rect, line, and point glyphs. It avoided larger polar, hierarchy, geo, and density work because the current glyph primitives could unlock more catalogue coverage with less architectural risk.
Major Changes Delivered
- Added
errorIntervalandfinancialIntervaltransform contracts inapp/src/lib/viz/compiler/spec.ts. - Implemented grouped error interval rows and ordered OHLC rows in
app/src/lib/viz/compiler/transforms.ts. - Added explicit numeric scale domain
min/maxcontrols inapp/src/lib/viz/compiler/scales.ts. - Added gallery specs for:
app/src/lib/viz/compiler/gallery-specs/error-bars.tsapp/src/lib/viz/compiler/gallery-specs/candlestick-chart.tsapp/src/lib/viz/compiler/gallery-specs/open-high-low-close.tsapp/src/lib/viz/compiler/gallery-specs/span-chart.ts
- Registered the new charts in
app/src/lib/viz/compiler/gallery-specs.tsandapp/src/lib/viz/compiler/gallery-specs/types.ts. - Updated catalogue docs and trackers:
docs/chart-catalogue-gallery/compiler-gap-analysis.mddocs/chart-catalogue-gallery/README.mddocs/chart-catalogue-gallery/implementation-tracker.md- Per-chart docs for Error Bars, Candlestick Chart, OHLC Chart, and Span Chart.
Design Decisions And Tradeoffs
- Chose
errorIntervalbefore density/regression because it unlocks Error Bars with simple, inspectable output rows and does not require generated paths or smoothing. - Chose
financialIntervalbecause Candlestick and OHLC share the same open/high/low/close contract, so one transform enables two catalogue charts. - Added explicit numeric domain bounds instead of a multi-field domain aggregator. This keeps the scale API small while solving immediate OHLC/error-axis needs. A richer domain aggregation policy is still useful later.
- Reused the existing
intervaltransform for Span Chart. That keeps span charts as another interval rendering mode instead of inventing a chart-specific transform. - Left line cap/join styling and time scales for follow-up work. The new charts are faithful enough with separate cap/tick line layers, and temporal scale work is broader than this pass.
Problems Encountered And Resolutions
- Test list drift: the first test run incorrectly treated
errorBarsas a numeric-x chart andspanChartas a y-grid chart. Resolution: corrected the guide-spacing test chart lists to match each chart's actual scale orientation. - Validation scope: an existing dev server was already listening on
localhost:3000. Resolution: reused the running server for browser smoke tests instead of starting a duplicate server on another port.
Verification And Validation
pnpm -C app type-check: passed.pnpm -C app test: passed, 17 compiler tests.pnpm -C app lint: passed with three existing warnings inapp/src/middleware.ts; none were introduced by this pass.git diff --check: passed.- Browser smoke tests against
http://localhost:3000/_internal/chart-compiler/*: passed forerrorBars,candlestickChart,openHighLowClose, andspanChart; each route showed its expected title, transform declaration, SVG content, and no browser console errors.
Process Improvements
- Keep guide-spacing test lists grouped by scale orientation. This prevents newly added band-axis charts from being forced through numeric tick expectations.
- For future chart batches, pick transform clusters that unlock more than one catalogue method. The financial interval transform was a high-yield example because it served both Candlestick and OHLC.
- Continue updating
compiler-gap-analysis.mdimmediately after implementation, while the current limitations and evidence are still precise.
Agent And Skill Improvements
- Add a lightweight checklist to the chart-catalogue workflow: when adding a gallery chart, update the type union, registry order, compiler test expected order, docs README, tracker, and gap coverage table in the same pass.
- Add a note to the Solid/compiler skills that generated guide tests should distinguish numeric, band, and categorical axes before adding new chart ids.
- Expected benefit: fewer late test-list corrections and more consistent documentation for each new catalogue chart.
Follow-ups And Open Risks
- P0: Add true
timescale support for Gantt, Span, Candlestick, OHLC, and Timeline examples. - P1: Add outlier extraction for Box & Whisker Plot and richer statistical policy options for Error Bars.
- P1: Add regression and density transforms for scatter trend lines, density plots, and violin plots.
- P1: Add step/smooth path interpolation for richer line/area families.
- P2: Add reusable line cap/join/dash style params instead of modeling every cap as a separate line layer.