Skip to content

feat(web): interactive real and complex 2D charts with numerical sampling - #301

Draft
PawelTroka wants to merge 4 commits into
masterfrom
feature/web-2d-chart-interactions-20261028
Draft

PawelTroka wants to merge 4 commits into
masterfrom
feature/web-2d-chart-interactions-20261028

Conversation

@PawelTroka

@PawelTroka PawelTroka commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Why

Addresses the browser 2D interaction gap in #292: ordinary real and complex charts currently replace one static PNG. This is a separate workstream from draft #294.

Draft — do not merge without the owner's explicit approval.

What changes

  • Opt-in interactive2D on the existing POST /api/v2/chart returns bounded real-curve or complex-value samples through the existing evaluator, request-local custom definitions and isolated worker. Default API callers and implicit expressions retain PNG rendering.
  • Coordinate-aware Canvas 2D plotting provides pointer-anchored wheel zoom, drag pan, touch pinch, keyboard and toolbar controls, reset and explicit bounds. New viewports request mathematical samples; resize and complex display changes reuse cached numbers.
  • Add function supports up to eight real overlays, each with independent visibility/removal and a frozen expression/custom-function snapshot. Sequential sampling batches publish atomically; cancellation, errors and late responses preserve the last committed plot.
  • Existing layers can become empty when navigating outside their mathematical domain without blocking other functions. A narrowly scoped allowEmpty2D opt-in permits this; new Draw/Add operations still reject an entirely undefined initial domain.
  • Complex None/Linear/Logarithmic contours, validated spacing, magnitude color direction, axes and nearest-sample inspection. PNG export includes the current viewport, visible functions, axes and legend.
  • Bounded midpoint checks break common off-grid poles without disconnecting steep straight lines. Undefined values become holes. Tick and hover precision follows the visible span.

Verification

Current source head: 75aef98191149838d13a02c3e808c9f5802271d8.

Current-head check Result
Windows API regression suite 152 passed, 1 existing documented 3D skip, all 23 new chart cases passed; published API smoke passed — job, diagnostics
Real Windows API + Chromium/Firefox acceptance 16/16 passed, no skips — run, screenshots and PNG exports
Real custom functions and worker cancellation 26/26 passed, no skips/failures, Chromium and Firefox — run, browser evidence
Published frontend build, audit and browser suite 262/262 passed, no skips; build/audit passed, 0 vulnerabilities — run, diagnostics
Combined 2D/WebGL Windows acceptance 20/20 passed, no failures/errors/skips, actual WebGL in Chromium and Firefox — run, source identifiers and screenshots/exports

The final combined artifact retains 32 unique PNG stages, including all ten switching stages in each browser. Those twenty switching images were visually inspected: 2D axes/labels/legends are complete, WebGL visibly rotates/zooms, and exports contain the plotted content. Source identifiers and the downloaded artifact digest were verified.

Coverage includes actual wheel/drag/keyboard, native Chromium two-finger pinch, per-layer source snapshots, cached resize/color controls, domain-limited layers, cancellation/stale-result guards, malformed responses, request bounds, and decoded PNGs with nonblank plot pixels. API tests cover independent numerical values, grid orientation, singularities, custom definitions and isolation, sampling/precision limits, legacy PNG compatibility and cancellation.

PR #294 compatibility

Target: 9fc1b7949fab5dab4cd3ce04cfef2bf944511b01, based on master fe1aba49b5f9538355ffaaa3d1683f69a23d2d9c.

  • Numeric 2D dispatch applies only to explicit real/complex functions; the surface contract remains separate.
  • A reproducible disposable-checkout workflow applies the immutable feat(web): interactive f(x,y) 3D surface charts with numerical sampling and WebGL #294 diff and a reviewed integration bridge. Chart.tsx and the solution documentation inventory need explicit reconciliation; conflict-free merging is not claimed.
  • The bridge preserves lazy SurfacePlot, quality selection, cached resize, camera controls, WebGL reporting and export. This standalone PR does not add Plotly or duplicate SurfacePlot.
  • Full switching exposed an asynchronous resize callback after the surface was removed. The bridge includes a narrow lifecycle guard and handles obsolete resize rejections while retaining errors for a live plot. The strict no-pageerrors assertion remains intact.
  • The additional acceptance scenario switches real → WebGL → real → complex on one page, checks independently expected numbers and renderer disposal, exercises camera/viewport changes, and exports nonblank PNGs. Actual WebGL is required in both browsers.
  • Clean LF and actual CRLF preparations produce the same combined tree: 281fdbabeb40001adfc362cb02405d321d00c5b9. Bridge SHA-256: 881efd2f00e1768cc1b69aea334ab85c6c29a0cfcc8b97d897f77f16e517c542. CI retains these identifiers in webgl-294.json alongside screenshots and results.
  • Validation changes neither source PR nor master and merges neither draft PR.

Remaining differences

Implicit charts retain PNG/manual bounds. Real overlays are bounded at eight; complex charts retain one field, as on desktop. Scripted point series, desktop autoscale variants, per-axis wheel modifiers, arbitrary style/property dialogs and print dialogs remain separate.

Desktop exponential contours are omitted because their current magnitude-dependent loop has problematic/nonterminating edge cases. The browser's lighter color direction follows documented endpoint semantics instead of reproducing the desktop formula discrepancy; exact color-pixel parity is not claimed. Sampling is finite and bounded, so narrow features may require zooming. API hosting remains Windows-dependent. Visual review also records the inherited #294 camera/aspect framing: a tall paraboloid can extend beyond the frame and crop ground-axis labels; 3D framing improvements remain in that workstream.

Architecture, contracts, commands and parity boundaries: WEB-2D-INTERACTIONS.md.

All requested chart, API and browser gates above passed on the current head, and the complete four-job Windows regression matrix passed. At the latest check, 21 of 22 repository workflows were successful; the separate release identity/candidate evidence workflow was still running, with no reported failure.

This PR remains draft. No existing or new PR has been merged.

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