Skip to content

RFC: Canvas and SVG Renderer Implementation Plan#2299

Open
kswenson wants to merge 1 commit intomainfrom
CODAP-295-canvas-svg-renderer-plan
Open

RFC: Canvas and SVG Renderer Implementation Plan#2299
kswenson wants to merge 1 commit intomainfrom
CODAP-295-canvas-svg-renderer-plan

Conversation

@kswenson
Copy link
Member

Summary

This PR adds an implementation plan for two new renderers to address WebGL context limitations and SVG export needs:

  • CanvasPointRenderer: Canvas 2D fallback when WebGL contexts are exhausted (browsers limit to ~16)
  • SVG Export Utility: Clean SVG generation for image export (replacing foreignObject approach)

Purpose

This is a Request for Comments - the PR contains only the plan document (v3/doc/point-rendering-plan.md) for team review before implementation begins.

Key Design Decisions

  1. Keep PIXI.js - Continue using PIXI for WebGL rendering rather than writing custom WebGL code
  2. Canvas for runtime fallback - Use Canvas 2D when WebGL unavailable (better performance than SVG for large datasets)
  3. SVG as utility function - Export-only, no event handling needed, simpler than full renderer class
  4. d3-quadtree for hit testing - O(log n) lookups for Canvas event handling

Open Questions

  1. Is d3-quadtree already available as a dependency?
  2. What performance threshold should trigger degraded experience messaging?
  3. Should SVG export read from CanvasPointRenderer state or directly from PointsState?

Review Request

Please review the plan and leave comments on:

  • Overall approach
  • Implementation phases
  • Any concerns or alternative suggestions

🤖 Generated with Claude Code

This plan outlines the approach for adding:
- CanvasPointRenderer: Canvas 2D fallback when WebGL contexts exhausted
- SVG export utility: Clean SVG generation for image export

The plan is intended for team review and discussion before implementation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

❌ Patch coverage is 77.49382% with 273 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.39%. Comparing base (98bcf2b) to head (46addba).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...nents/data-display/renderer/pixi-point-renderer.ts 61.45% 156 Missing and 19 partials ⚠️
...mponents/graph/plots/scatter-plot/scatter-plot.tsx 13.33% 12 Missing and 1 partial ⚠️
...isplay/components/no-webgl-context-placeholder.tsx 28.57% 10 Missing ⚠️
...onents/data-display/renderer/use-point-renderer.ts 89.15% 9 Missing ⚠️
.../src/components/map/components/map-point-layer.tsx 76.47% 8 Missing ⚠️
...ponents/data-display/hooks/use-connecting-lines.ts 22.22% 4 Missing and 3 partials ⚠️
...nents/data-display/renderer/point-renderer-base.ts 94.91% 6 Missing ⚠️
...s/data-display/renderer/point-renderer-context.tsx 44.44% 4 Missing and 1 partial ⚠️
.../components/data-display/components/background.tsx 55.55% 4 Missing ⚠️
...isplay/hooks/use-renderer-pointer-down-deselect.ts 55.55% 4 Missing ⚠️
... and 15 more

❗ There is a different number of reports uploaded between BASE (98bcf2b) and HEAD (46addba). Click for more details.

HEAD has 9 uploads less than BASE
Flag BASE (98bcf2b) HEAD (46addba)
cypress 10 1
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2299       +/-   ##
===========================================
- Coverage   86.69%   69.39%   -17.30%     
===========================================
  Files         724      733        +9     
  Lines       38770    39292      +522     
  Branches     9588     9688      +100     
===========================================
- Hits        33610    27266     -6344     
- Misses       5151    11288     +6137     
- Partials        9      738      +729     
Flag Coverage Δ
cypress 40.54% <63.77%> (-31.24%) ⬇️
jest 55.94% <37.01%> (+0.20%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cypress
Copy link

cypress bot commented Jan 19, 2026

codap-v3    Run #9660

Run Properties:  status check passed Passed #9660  •  git commit 46addba789: docs: add implementation plan for Canvas and SVG renderers
Project codap-v3
Branch Review CODAP-295-canvas-svg-renderer-plan
Run status status check passed Passed #9660
Run duration 03m 13s
Commit git commit 46addba789: docs: add implementation plan for Canvas and SVG renderers
Committer Kirk Swenson
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 4
View all changes introduced in this branch ↗︎

@kswenson kswenson added the v3 CODAP v3 label Jan 19, 2026
@kswenson kswenson changed the base branch from main to CODAP-295-graph-render-refactor January 20, 2026 17:29
Base automatically changed from CODAP-295-graph-render-refactor to main February 4, 2026 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v3 CODAP v3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant