Skip to content

feat: add Delaunay/Voronoi marks and Hull mark#541

Merged
gka merged 23 commits into
svelteplot:mainfrom
RobertFrenken:feat/delaunay-marks
Apr 8, 2026
Merged

feat: add Delaunay/Voronoi marks and Hull mark#541
gka merged 23 commits into
svelteplot:mainfrom
RobertFrenken:feat/delaunay-marks

Conversation

@RobertFrenken

@RobertFrenken RobertFrenken commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds 5 new mark components: DelaunayLink, DelaunayMesh, Hull, Voronoi, VoronoiMesh
  • Voronoi/VoronoiMesh clip cells to plot frame bounds
  • All 5 marks support grouping by z, fill, stroke, and facet (fx/fy) channels via groupFacetsAndZ
  • Hull supports implicit grouping by fill/stroke channels (consistent with Observable Plot)
  • Documentation page with live examples using penguins and Walmart datasets
  • Separate example files in src/routes/examples/delaunay/
  • Shared SVG+canvas path rendering helpers: PathGroup (for mesh/hull-style marks) and PathItems (for per-datum interactive marks), plus GeoPathGroup/GeoPathCanvas for Contour and Density
  • All 7 marks (DelaunayLink, DelaunayMesh, Hull, Voronoi, VoronoiMesh, Contour, Density) expose a canvas prop for canvas-accelerated rendering

Closes #84

Split from #531 per reviewer request — hexbin mark and transform moved to a separate PR.

Test plan

  • pnpm test passes (829 tests)
  • pnpm build succeeds
  • pnpm lint passes
  • Doc page renders correctly at /marks/delaunay
  • Visual regression tests

🤖 Generated with Claude Code

Add DelaunayLink, DelaunayMesh, Voronoi, VoronoiMesh, and Hull marks
with documentation page.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@netlify

netlify Bot commented Apr 7, 2026

Copy link
Copy Markdown

Deploy Preview for svelteplot ready!

Name Link
🔨 Latest commit 1f64cfc
🔍 Latest deploy log https://app.netlify.com/projects/svelteplot/deploys/69d64142047d7b0008d95489
😎 Deploy Preview https://deploy-preview-541--svelteplot.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

RobertFrenken and others added 4 commits April 6, 2026 21:08
Use SvelteSet/SvelteMap instead of built-in Set/Map per
svelte/prefer-svelte-reactivity rule. Add keys to {#each} blocks
per svelte/require-each-key rule.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove 'z' from channels arrays (not a ScaledChannelName)
- Use ScaledDataRecord without Datum generic to match Mark's children type
- Add PlotDefaults entries for all new marks
- Import new mark components in plot.ts
- Use resolveProp for z-channel grouping in Hull (follows Line convention)
- Cast strokeOpacity/strokeWidth in mesh marks
- Move strokeWidth default out of Mark defaults prop in Hull

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@gka gka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you remove the hexbin docs that snuck into the delaunay docs?

aside from this, this feature still lacks a few things, but we can take care of them in separate PRs before releasing the next version.

  • unit tests
  • example plots
  • canvas rendering

Comment thread src/routes/marks/delaunay/+page.md
RobertFrenken and others added 18 commits April 7, 2026 15:37
…in docs

Add comprehensive unit tests for all 5 Delaunay/Voronoi marks:
- Voronoi (16 tests): rendering, styling, channel mapping, events, edge cases
- VoronoiMesh (11 tests): single-path rendering, attributes, edge cases
- DelaunayMesh (10 tests): triangulation path, attributes, edge cases
- DelaunayLink (12 tests): per-edge paths, styling, events, deduplication
- Hull (14 tests): grouping by z/fill/stroke, styling, edge cases

Fix Hull grouping bug where NaN coordinates during initial reactive render
caused duplicate keyed-each keys crash:
- Guard against NaN with Number.isFinite() instead of typeof === 'number'
- Use index-based each key instead of path string to prevent duplicate keys

Remove hexbin docs (Hexgrid + Hexbin transform sections) that were
incorrectly included in the Delaunay docs page — these belong in the
hexbin PR (svelteplot#542).

## New mark checklist (remaining items for this feature)

- [x] Component source (`src/lib/marks/`)
- [x] Type definitions (`src/lib/types/mark.ts`)
- [x] Exports (`src/lib/marks/index.ts`)
- [x] Sidebar config (`config/sidebar.ts`)
- [x] Docs page (`src/routes/marks/delaunay/+page.md`)
- [x] Unit tests (`src/tests/`)
- [ ] Examples gallery (`src/routes/examples/delaunay/`)
- [ ] Visual regression snapshots (`src/snapshots/delaunay/`)
- [ ] Canvas rendering variants

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gka gka merged commit bfbef00 into svelteplot:main Apr 8, 2026
8 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.

feature: add Delaunay mark

2 participants