diff --git a/.claude/docs/XR_COMPONENTS.md b/.claude/docs/XR_COMPONENTS.md index d0da10ce..9501cd71 100644 --- a/.claude/docs/XR_COMPONENTS.md +++ b/.claude/docs/XR_COMPONENTS.md @@ -33,9 +33,9 @@ The analysis table is the central XR surface; the old "pedestal" was split into ## Chart system - **Registry**: `src/core/charts/chartRegistry.ts` (`BabiaChartRegistry` singleton) — chart types + dimension requirements (`models/chartModels.ts`: `ChartMetadata`, `DimensionMapping`). -- **Presentation contract**: `src/core/charts/chartPresentation.ts` (`CHART_PRESENTATION_PROFILES`) is the single source for how every chart presents on the table — entity rotation (pie/donut stand at `90 0 0`, Babia's own convention), containment fit strategy (`uniform` / `planar-uniform` / per-axis), base component attributes beyond the mapped fields (bubbles' `heightMax`/`radiusMax`, cyls' `radiusMax`, boats' full base), row budget + ranking dimension for the top-N data slice, the Babia element-key dimensions (duplicate keys collapse elements, so slices de-duplicate), and `surfaceLift` (clearance above the anchor plane — it sits at the tabletop slab, ~1.7 cm under the visible glass, which slices round-bottomed geometry; note the anchor's ~1.5 cm anti-jitter deadband swallows smaller lifts). Templates are BUILT from it (`buildChartEntityHtml` in `templateCharts.ts`), the scene injects it as JSON (`#codexr-chart-base-config`, `createStructure.ts`), and the mapping runtime keeps a fallback mirror — same pattern that already protected babia-boats. +- **Presentation contract**: `src/core/charts/chartPresentation.ts` (`CHART_PRESENTATION_PROFILES`) is the single source for how every chart presents on the table — entity rotation (pie/donut stand at `90 0 0`, Babia's own convention), containment fit strategy (`uniform` / `planar-uniform` / per-axis), base component attributes beyond the mapped fields (bubbles' `heightMax`/`radiusMax`, cyls' `radiusMax`, boats' full base, and `animation: false` on bars/barsmap/cyls/cylsmap, whose BabiaXR default grows them from the floor while containment measures them), an optional `maxHeight` in metres that widens a uniform fit's height band (pie/donut stand up to 2 m), row budget + ranking dimension for the top-N data slice, the Babia element-key dimensions (duplicate keys collapse elements, so slices de-duplicate), and `surfaceLift` (clearance above the anchor plane — it sits at the tabletop slab, ~1.7 cm under the visible glass, which slices round-bottomed geometry; note the anchor's ~1.5 cm anti-jitter deadband swallows smaller lifts). Templates are BUILT from it (`buildChartEntityHtml` in `templateCharts.ts`), the scene injects it as JSON (`#codexr-chart-base-config`, `createStructure.ts`), and the mapping runtime keeps a fallback mirror — same pattern that already protected babia-boats. - **Rotation has exactly one owner: the presentation profile.** Anywhere a babia chart component is attached to an entity, the entity's `rotation` must be (re)derived from `getChartPresentation(chartId).rotation` — never inherited, never left over. Three builders learned this the hard way and now follow it: the live switch (`applyChartTypeToEntity`), the evolution movie (`buildEvolutionChart`) and the comparison clones (`createChartFromTemplate`). The same applies to the `data-codexr-active-chart-id` marker, which the containment reads to pick the fit strategy and the surface lift — a stale marker mis-fits the chart. Note that the containment's own transform snapshots (`cloneTransform`/`restoreTransform`) deliberately carry position, scale and visibility only, so they can never be the source of a rotation problem. -- **Row-budgeted datasource**: every chart except boats reads from a CodeXR-maintained sliced `babia-queryjson` entity (`codexrChartDataSlice__`, `chartDataSlice.js` part of the mapping runtime). The slice ranks rows by the mapped magnitude, honours `numeric-positive` value rules by VALUE (a zero radius makes babia-cylsmap compute `-Infinity` axis lengths), and keeps one row per Babia element key. It subscribes to the real producer's NotiBuffer, so re-analysis pushes and evolution frame swaps flow through. +- **Row-budgeted datasource**: every chart except boats reads from a CodeXR-maintained sliced `babia-queryjson` entity (`codexrChartDataSlice__`, `chartDataSlice.js` part of the mapping runtime). The slice ranks rows by the mapped magnitude, honours `numeric-positive` value rules by VALUE (a zero radius makes babia-cylsmap compute `-Infinity` axis lengths), and keeps one row per Babia element key. It subscribes to the real producer's NotiBuffer, so re-analysis pushes and evolution frame swaps flow through. Since 1.2.1 that is true for every producer, not just the main `data`: project evolution (`codexrChartDataSlice__codexrProjectEvolutionData`) and each comparison side (`codexrChartDataSlice__codexrComparisonData{Left,Right}`) warm their slice with `prepareChartDataSlice()` and wait for its NotiBuffer before building the chart on it (A-Frame lists a component before its `init()` runs, so "the component exists" is not enough). A slice whose producer was removed and rebuilt under the same id re-subscribes to the new one. `getChartFromSource` keeps any flat producer a chart already reads and only swaps a tree for `data` (it used to fall back to `data`, re-slicing the main dataset from the evolution chart). - **Validation**: `processing/dimensionValidator.ts` validates mappings against the Python-derived field schema (see `PYTHON_ANALYSIS.md` → field-schema contract) before launch. The in-scene Mapping UI performs transactional mapping changes with safe recovery. - **Default hierarchical chart is Babia Boats.** The custom `code-xr-boats` ("Code City") prototype was **deleted on `fix/gitcontroller` (2026-07-25)** — nothing injected it, generated scenes use `babia-boats`, and old configs migrate (see V1.2.0_STATUS.md). diff --git a/apps/vscode-extension/CHANGELOG.md b/apps/vscode-extension/CHANGELOG.md index 7358ce52..757657ab 100644 --- a/apps/vscode-extension/CHANGELOG.md +++ b/apps/vscode-extension/CHANGELOG.md @@ -60,6 +60,16 @@ - The table fit checked the chart's size but not its position: centring the bars could push the axis off one side. The axes are now kept on the table, and a chart that still sticks out is no longer reported as fitted. - The fit could measure a cached, outdated size of a line that had just changed. Sizes are now re-read when the geometry changes. - Generated scenes first built every chart over all files and only then switched to the top 20/30 shown. They now build once, from the files that are shown. +- **Charts no longer flash oversized, grow into towers or leave the table while they are rebuilt.** Every way a chart is (re)built now follows the same rules: it reads the row-limited data, stays hidden until it has been fitted to the table, and only then appears. + - Switching chart type drew the new chart at the previous chart's scale for a moment, up to 75 m wide. It is now hidden until fitted. + - Bar and cylinder charts grew up from the floor on their first build, reaching 26-32 m before the fit caught up. BabiaXR's grow animation is now off for them. + - The project evolution movie built every frame from all of its files (a 160-file frame gave a wall of 138 bars that sat oversized for almost 4 s). Frames now use the same top 20/30 as the classic analysis, a frame that would overflow is hidden until it is fitted, and frames no longer wait for an animation that never ran. + - Each side of a historical comparison now shows the top files of its own revision instead of all of them, and starts from the chart's own scale instead of a fixed one that squashed pie, donut and bubble charts. + - Changing which field labels the bars no longer leaves "ghost" bars from the previous mapping behind. + - A mapping with no files to show says "No files to show for this mapping." instead of blaming the mapping or showing "still rebuilding" forever. + - Bubble charts rested their smallest bubble on the table and sank their axes up to 0.6 m into it. The lowest of the bubbles and the axes now rests on the table. + - Pie and donut charts stand up to 2 m tall (they were about 1.3 m), so their sectors and labels are readable from the controller position. + - A live re-analysis no longer undoes a remap you made while the charts were refreshing, and a second chart change made in project evolution while the first is applied is no longer ignored. - A source file of the XR chart-mapping runtime contained a raw control character typed into a string. Behaviour was correct, but the file was invisible to code search and review tools. It now uses the equivalent escape sequence; the runtime value is identical. ## [1.2.0] - 2026-07-30 diff --git a/apps/vscode-extension/src/core/charts/chartPresentation.ts b/apps/vscode-extension/src/core/charts/chartPresentation.ts index 0c9bcba9..e3e48a1f 100644 --- a/apps/vscode-extension/src/core/charts/chartPresentation.ts +++ b/apps/vscode-extension/src/core/charts/chartPresentation.ts @@ -117,6 +117,13 @@ export interface ChartPresentationProfile { * against jitter, so a lift only takes effect above that. */ surfaceLift?: number; + /** + * Tallest the chart may stand above the table, in metres, replacing the + * table's height band for this chart. Only the standing pie and donut set + * it: a standing disc's height IS its diameter, so the band sized for bar + * heights held them to ~1.27 m across on a 5.6 m table (CHARTS-15). + */ + maxHeight?: number; /** * Component attributes the chart always needs beyond the mapped fields * (normalization caps, title placement, boats construction). Merged under @@ -125,7 +132,15 @@ export interface ChartPresentationProfile { baseAttributes: Record; } +// Pie and donut stand on the table as discs up to 2 m across: large enough to +// read the slices from the table's edge, low enough that the top stays near +// eye height for a standing user (decision recorded for epic #72, story S8). +const STANDING_DISC_MAX_HEIGHT = 2; + export const CHART_PRESENTATION_PROFILES: Record = { + // The row charts are built with Babia's grow animation OFF. Bars and + // cylinders default to growing from 0 over 2 s, and containment fitted + // them mid-growth: towers 25-36 m tall for ~3 s on every build (CHARTS-5). bars: { rotation: '0 0 0', initialScale: '1.5 1.5 1.5', @@ -133,7 +148,7 @@ export const CHART_PRESENTATION_PROFILES: Record