Skip to content

Graphlink advanced visualization: ChartSpec V2, linked brushing, data-verified branches and scientific layers - #1057

Merged
dovvnloading merged 34 commits into
mainfrom
feat/advanced-scientific-chart-layers
Nov 25, 2026
Merged

dovvnloading merged 34 commits into
mainfrom
feat/advanced-scientific-chart-layers

Conversation

@dovvnloading

@dovvnloading dovvnloading commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Graph-native linked brushing and source-row chart branching

  • Brush a rectangle in a ChartSpec V2 facet to highlight the original row indices across point, line and uncertainty-band layers, without relying on display samples. Enter/Space selects a whole panel; Escape clears. Linear/log10 axes are inverted in data units.
  • Branch selected rows creates a new connected composite chart beside its source, retaining original numeric/categorical columns, chart layers and units. The backend filters from current canonical saved data only, validates expected source snapshot, source indices, range, uniqueness and size, and never accepts user-supplied replacement measurements.
  • One undoable scene.branchCompositeSelection command creates the derived chart and its source relationship. Save/load now resolves chart-to-chart parent IDs, preserving graph lineage across reloads. Invalid or stale selections create nothing.
  • Backend/frontend keyboard, drag, selection, source-fidelity, security, transport, undo/redo and session-reload regressions included.
  • This is in-figure linked brushing plus graph-native derivation, not yet selection synchronization between unrelated chart nodes.

Additional: editable and recommended composite figures

  • Native Composite figure editor: add/remove point, line, band and area layers, bind numeric X/Y/upper-bound fields, categorical colors, facet panels and labels, with a safe live preview.
  • Authenticated undoable scene.setCompositeDesign intent validates layers against immutable original data, checks expected previous design to reject stale saves, supports undo/redo, and never accepts client changes to numeric or categorical arrays.
  • Deterministic visualization advisor suggests existing-column grouped trends, observed interval bands, facets and scatter comparisons, with explanations; does not fabricate measurements or assume inferential uncertainty.
  • Shared legend colors and display-wide SVG mark limits remain bounded, including multiple color-by fields and dense facets.
  • Added backend and frontend security, scientific validity, UI interaction, wire-transport and undo tests.

New: ChartSpec V2 — composable multi-panel figures

  • A ninth chart type, Composite figure, is now available from Generate → Chart and the existing scene.generateChart intent.
  • Versioned, typed columnar data: 2–12 numeric fields, up to four categorical fields, 2–2,000 aligned observations, 1–8 point/line/band/area layers, up to six faceted panels, and optional color grouping.
  • Data-bound layers reference named original columns; band bounds must already exist and be ordered. Untrusted scripts, arbitrary visual expressions, callbacks and URLs are not supported. Unsupported/oversized chart specifications are rejected.
  • Interactive React SVG, low-zoom overview, Matplotlib SVG/PDF/PNG publication export, source-preserving save/reload, generated wire contracts, tests and documentation.
  • The initial grammar is deliberately bounded and dependency-free. It is not yet full Vega-Lite, external dataset storage or cross-chart linked brushing.

Implemented — advanced scientific visualization (first major tranche)

Actual code, not mocks or design proposals.

  • Unweighted OLS per numeric linear-axis scientific series, with pointwise Student-t 95% confidence bands, R², n, faithful SVG/PNG/PDF export.
  • Raincloud distributions for box plots: Gaussian KDE, Tukey quartiles, raw observations with bounded deterministic jitter; live view, overview, publication export.
  • Average-linkage hierarchical heatmap clustering (Euclidean distance): independently toggle rows/columns, reproducible dendrograms, stable original indices in tooltips, full publication rendering.
  • Extend scientific line/scatter to 10,000 total observations, with defensive canonical validation, bounded 1,200-point viewport-aware SVG marks and 400-point overview sampling. Raw data, fit computation, versioning, and publication exports preserve all original samples.
  • Hexbin density on single-series linear scatter plots: count all visible observations into hexagonal cells (not the display sample), separate count-aware tooltips, publication count colorbar, opt-in undoable mode.
  • Chat-node Generate → Chart now exposes all eight backend-supported chart types, including Scatter, Box plot, and Heatmap. Tests cover submenu ordering and dispatch.
  • Extended version-1 contract/TypeScript generated wire schema, server/client validation, user controls, documentation, and focused backend + Vitest test suites.

Behavior and correctness

Original observations and persisted source data are never mutated by these view layers. Existing chart types and default visualization stay unchanged until a layer is opted in. New mode choices persist through the existing undoable chart-analysis intent, and export uses stored source data.

Regression intervals assume independent, homoscedastic residuals and are pointwise mean-response intervals, not prediction intervals, and do not use measurement error as weights. Raincloud density widths are relative within a group, not cross-group mass. Heatmap Euclidean distances are unit-sensitive. SVG representative sampling is visualization-only; hexbin explicitly communicates density.

Review and CI

  • Branch feat/advanced-scientific-chart-layers builds on main; draft / do not merge until CI is green.
  • CI previously identified and prompted fixes for a floating-point bound and a hexbin lint rule. New runs are pending/running.
  • This is a meaningful first release slice; it does not yet deliver the full Vega-Lite/ChartSpec V2 grammar, Arrow/DuckDB datasets, or ELK canvas layout engine.

@dovvnloading dovvnloading changed the title Advanced scientific chart layers: OLS confidence bands and raincloud plots Advanced chart engine: OLS bands, rainclouds, clustered heatmaps, hexbin and 10k samples Nov 24, 2026
@dovvnloading dovvnloading changed the title Advanced chart engine: OLS bands, rainclouds, clustered heatmaps, hexbin and 10k samples Graphlink advanced visualization engine: ChartSpec V2, composite facets, scientific layers and 10k plots Nov 24, 2026

@dovvnloading dovvnloading left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review — changes needed before merge

Reviewed the chart canonicalization, analysis and rendering paths, statistical helpers, sampling and regression coverage at 12a53d33. Three correctness findings:

[P1] Zoom can erase a valid line segment or connect unrelated visible vertices. web_ui/src/app/canvas/charts/scientificSampling.ts:17–25 filters all vertices outside the X viewport before ScientificChartMarks.tsx:178–182 constructs a single path. Reproduced the actual selection branch with x=[0,10], y=[0,10], viewport x=[4,6], y=[0,10], kind=line: it returns [] even though the diagonal crosses the visible rectangle. The previous full path plus clipPath showed the crossing. For lines, retain segment endpoints at viewport boundaries and preserve path breaks where a nonmonotonic series exits/re-enters; do not connect separated runs across omitted data. Add crossing-with-no-visible-vertex, boundary and nonmonotonic zoom tests, including the pre-existing <=300-observation case.

[P1] Precise axis ranges fail whenever OLS or hexbin is enabled. web_ui/src/app/canvas/charts/ChartAnalysisPane.tsx:252–255 calls canonicalizeChartAnalysis without its new data parameter. The regression and density validation in chartSpec.ts:190–215 explicitly requires data, so Apply ranges throws even with valid bounds. Pass chartData, as the commit path already does, and exercise Apply ranges with each mode enabled, including locked ranges.

[P2] Composite color legend can omit valid categories. CompositeChartMarks.tsx:120 truncates the global palette legend to the first eight values. The canonicalizers allow eight groups independently per colorBy field, so two layers using distinct categorical fields with eight disjoint labels each are valid, but eight labels are omitted and colors may repeat. Bound the union or define explicit field-aware color/legend semantics; add a multi-layer, multi-field fixture and check consistent labeling in publication exports.

CI for this head is still running, including scientific and MCP browser checks. POSIX has passed. Do not merge until these findings are addressed and the resulting head passes all checks. This is a review comment rather than a formal request-changes review because the connected account is the PR author. No changes to the branch or CI gates.

…ends

Keep scientific line connectivity independent of sampled point markers, pass chart data into precise-range validation, and enforce one field-aware eight-slot legend in both canonicalizers and renderers. Add interaction, rendering, export and validation regressions.

@dovvnloading dovvnloading left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up to the three review findings: fixed on 7ea3c2d (11 files). P1 line rendering now keeps the connected full-source path and uses the existing SVG clip path; the 1,200-glyph budget remains for interactive point/error marks. P1 precise-range validation now receives chartData, including with OLS/hexbin and locked axes. P2 both canonicalizers enforce eight shared color/legend slots across the figure, including ungrouped layers; distinct (field, value) pairs receive distinct identities, repeated bindings reuse a slot, and the live and publication renderers share that ordering. The legend has dedicated space instead of truncating entries. Added React interaction and backend export/validation regression tests and updated docs. Nine isolated checks against committed source passed (geometry, palette identities/limit, and range wiring). Full repo tests were not run locally: the environment cannot resolve github.com to clone the project. Fresh CI/browser checks are required on this head before merge. No CI gates changed.

@dovvnloading dovvnloading changed the title Graphlink advanced visualization engine: ChartSpec V2, composite facets, scientific layers and 10k plots Graphlink advanced visualization: ChartSpec V2, linked brushing, data-verified branches and scientific layers Nov 25, 2026

@dovvnloading dovvnloading left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge-readiness review

Reviewed the latest head 03e53b537a005fdc4f7354011512a941ecefcd96, concentrating on canonicalization, scientific rendering/export, source-row branching, persistence, and the three earlier review findings. The full connected scientific line path now survives viewport clipping; exact-range validation receives chart data for OLS/hexbin; and both canonicalizers enforce a shared field-aware eight-slot palette. The backend derives branches from canonical source rows, rejects stale snapshots and invalid indices, and records undoable commands. The new regressions cover these paths and generated wire compatibility.

Verified the four required CI jobs passed (Windows Python including compile/lint/pytest/performance and audit, frontend including schema/type/lint/Vitest/build, isolated wheel build, and POSIX checks), plus scientific-workbench and MCP Connect Chromium workflows. The nightly-only boot-smoke was skipped as designed. Main has eight intervening commits with no overlapping changed file paths; GitHub reports a clean merge and no unresolved review threads.

Non-blocking follow-up: scientific scatter sampling tests viewport inclusion using observation centers, so error bars whose centers are outside a zoomed viewport may no longer appear even if an uncertainty interval crosses the boundary. Underlying values and publication data are not lost; consider a dedicated clipping/sampling regression for this edge case. This is a targeted static review using the existing CI evidence, not a fresh native desktop run (checkout is blocked by DNS in this environment). No CI gates changed. I am recording a comment rather than self-approving because the connected account is the PR author. The stated CI prerequisite is satisfied; proceeding with the authorized squash merge if GitHub still permits it.

@dovvnloading
dovvnloading marked this pull request as ready for review November 25, 2026 10:29
@dovvnloading
dovvnloading merged commit 5c5dfd8 into main Nov 25, 2026
7 checks passed
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