Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
ad48f45
feat(webgl): Layer-agnostic marks and `Layer`, with WebGL-only `@laye…
techniq Nov 25, 2026
5819371
chore(docs): Bump @layerstack/docs to 1.0.0-next.8
techniq Nov 26, 2026
fcc9b96
feat(webgl): Core-matching 2D Bars, Bar, Circle, Graticule, Area line…
techniq Nov 26, 2026
4edf47d
docs: Draw core examples with WebGL from the layer toggle
techniq Nov 26, 2026
3bdce15
fix(webgl): Match core line widths, label offsets, link paths, and te…
techniq Nov 26, 2026
1f0a836
feat: layerchart/base, and WebGL Group, Line, compound marks, and Rec…
techniq Nov 26, 2026
9fe1972
feat(webgl): Motion, Path and its compound marks, labels, rounded cor…
techniq Nov 26, 2026
6651343
docs: Merge the WebGL component docs into the core pages, with shared…
techniq Nov 26, 2026
e32e086
feat(webgl): Pointer events, dashes, markers, and core props across m…
techniq Nov 26, 2026
8bfc601
docs: Shared and package-only API tables with inherited props, and mo…
techniq Nov 26, 2026
ddabb2b
docs: Filter examples by layer, type ahead in the category picker, an…
techniq Nov 26, 2026
f6fa9ab
feat(webgl): Radial charts, Axis and Grid parity, shared label painti…
techniq Nov 26, 2026
f71246d
docs: Open examples in the filtered layer, and check 51 more WebGL ex…
techniq Nov 26, 2026
8d75d63
feat(webgl): Simplified charts, facets, clip paths, gradients and pat…
techniq Nov 27, 2026
bdf5f7c
docs: Check 523 more WebGL examples, convert charts without a Layer, …
techniq Nov 27, 2026
d2b21bb
fix: Fill and stroke Canvas marks with a LinearGradient or Pattern again
techniq Nov 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .changeset/canvas-gradient-fill.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'layerchart': patch
---

fix: Marks in a `Canvas` layer fill and stroke with a `LinearGradient` or `Pattern` again (ex. an `Area`'s gradient fill)
7 changes: 7 additions & 0 deletions .changeset/layerchart-base.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'layerchart': minor
---

feat: `layerchart/base` exports the layer-agnostic bases of the marks and charts (ex. `PieBase`) and their state, for drawing LayerChart's components in a layer of your own
feat: `settings.layer` accepts `webgl`, drawn by `@layerchart/webgl`'s `Layer`
fix: Marks draw nothing outside an `Svg`, `Canvas`, or `Html` layer rather than throw, and `GeoPoint` draws in an `Html` layer
57 changes: 57 additions & 0 deletions .changeset/webgl-core-parity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
'@layerchart/webgl': minor
---

feat: Layer-agnostic marks and `Layer` (`type="webgl"`), drawing core's versions in `Svg`, `Canvas`, and `Html` layers so one chart can switch between all four; import WebGL-only marks from `@layerchart/webgl/webgl`
feat: `Bar`, `Circle`, `Graticule`, `Group`, `Line`, and `Path`, and LayerChart's compound marks built from them (`Pie`, `Labels`, `Calendar`, `Month`, `Cell`, `BoxPlot`, `Frame`, `Hull`, `GeoPoint`, `AnnotationPoint`, `AnnotationLine`, `Violin`, `Trail`, `Density`, `Ribbon`)
feat: `BarChart`, `LineChart`, `AreaChart`, `ScatterChart`, `PieChart`, and `ArcChart`, with their axes, grid, highlight, and annotations, drawn in whichever layer they're in
feat: `AnnotationRange`, `ArcLabel`, `Brush`, `Ellipse`, `FacetAxis`, `GeoBin`, `GeoCircle`, `GeoEdgeFade`, `GeoSpline`, `Image`, `Voronoi`, and `Waffle`
feat: Re-export LayerChart's layouts, contexts, and legends (`ChartGroup`, `Dodge`, `Point`, `Bounds`, `ForceSimulation`, `Chord`, `Sankey`, `Dagre`, `Treemap`, `Partition`, `Tree`, `Pack`, `GeoProjection`, `GeoVisible`, `CircleLegend`, `GeoLegend`)
feat: `LinearGradient` and `Pattern` paint WebGL marks' fills and strokes, blended as SVG blends them
feat: `ClipPath`, `RectClipPath`, `CircleClipPath`, `GeoClipPath`, and `ChartClipPath` clip marks in a WebGL scene (to any path, a `clip` snippet's shapes, or their inverse)
feat: Faceted charts (`fx` / `fy`), each panel's marks drawing its own rows, axes on the grid's outer edge (`facetAll` for every panel)
feat: Marks take core's `motion`, `key`, and `initial*` props, easing in as core's do
feat: Lines and paths take core's `draw`, `marker*`, `startContent` / `endContent`, and `dashArray`
feat: Marks take core's `fillOpacity`, `strokeOpacity`, `seriesKey`, pointer handlers, and the `--fill-color` / `--stroke-color` their classes or `style` set
feat(Area): Stack as core's, and take `line`, `stroke`, and `pathData`
feat(Axis): `top` / `right` / `angle` / `radius` placements, `grid`, rule markers, `tickOcclusion`, `tickMultiline`, `labelPlacement`, `label` / `tickLabel` snippets, tick label `rotate` / anchors / `dx` / `dy`, and `padding="auto"`
feat(Bars): Radial bars, and flat 2D bars without a `z`, with core's `insets`, `radius` / `rounded`, `stackPadding`, `x1` / `y1` sub-bands, fixed `width` / `height`, and `children`
feat(Bin): `r`, `grid`, `class`, and `children`
feat(Arc): Track `fillOpacity` and `strokeOpacity`
feat(Contour): Flat filled bands as core's, raised bands as terraces or colored outlines, and `blur`, `smooth`, and a `z` function
feat(GeoPath): `curve`, `geoTransform`, and `children`
feat(Grid): Radial spokes and circles (`radialY`), per-axis line props, `bandAlign`, and `classes`
feat(Highlight): `area`, `bar`, and point, area, and bar click handlers
feat(Link): Core's paths (`type`, `curve`, `orientation`, `sweep`, `radius`, `bend`, `sankey`, `radial`), one link as `data`, and `pathData`
feat(Points): `offsetX` / `offsetY`, `children`, `viewport`, and a point per value of a multi-value `x` / `y`
feat(Raster): `blur` and `imageRendering="crisp-edges"`
feat(GeoRaster): `resolution`
feat(GeoTile): `group` and `children`
feat(Rect): `insets`, `rx` / `corners`, and `shade`
feat(Spline): `fill`, `pathData`, and `class` / `opacity` functions styling each run of rows (ex. dashed across missing data)
feat(Text): Font from its `class`, `segments`, `path` / `startOffset` / `dominantBaseline`, and `capHeight`
feat: `Spline`, `Area`, `Points`, `Axis`, and `Grid` draw `radial` charts
fix(GeoPath): Default to no fill and a `var(--color-surface-content)` outline, as core's
fix(Grid): Draw only the lines turned on (ex. `<Grid x />`), as core's
fix(Text): Default `textAnchor` to `start`, as core's
fix: A class's own fill or stroke (including `fill-none` / `stroke-none`) wins over a mark's `fill` / `stroke` prop, as CSS does in core's layers
fix: `opacity` dims a mark's outlines and lines
fix: `Bars`, `Polygon`, and `Rect` default to `var(--color-surface-content)`, as core's
fix(Axis): Ticks, tick labels, and titles placed, sized, and counted as core's
fix(Highlight): Point each series at the hovered row, as core's (ex. a stack's bands)
fix(Bars): Take `opacity` as a function of the row, as core's
fix(Axis): Format an expanded stack's values as percentages, as core's
fix: `Spline` and `Points` take their series' `props`, as core's
fix: `Area` and `Spline` fade the other `c` categories while the legend highlights one, as core's
fix(Bin): Keep its cells as an isometric view turns
fix(Spline): Follow a stack's top, break at a map's edge, and default to 1px
fix(Area): Fill both sides of the baseline where its line crosses it
fix(Link): Draw a wide link as an even ribbon rather than overlapping round-capped segments
fix(Points): Lie flat on an isometric chart unless `viewport`, as core's
fix: Data-mode `Circle`, `Rect`, `Text`, `Line`, and `Polygon` add their data to the chart's domains, as core's
fix(Spline): Call a `stroke` function with the row's index and the line's rows, as core's
fix(Arc): Outline rounded corners the short way round (ex. a `fill-none` track)
fix: A scale with no domain (ex. `Dagre`'s pixel layout) places values as they are, as core's `Spline`
fix(Text): Clean label halos, and take its class's fill and text color
fix: Draw every mark of a flat chart with very many (ex. a `Calendar`'s day cells)
perf(Text): Reuse label paintings as labels move between marks or change size slightly
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"test:visual:update": "node scripts/visual-snapshot.mjs capture snapshots/baseline.json --repeat 3",
"generate:api": "layerstack-docs generate-api ../packages/layerchart/src/lib/components generated/api && layerstack-docs generate-api ../packages/webgl/src/lib/components generated/api/webgl",
"generate:screenshots": "layerstack-docs generate-screenshots src/examples/components static/screenshots",
"generate:catalog": "layerstack-docs generate-catalog ../packages/layerchart/src/lib/components src/examples/components src/examples/catalog && layerstack-docs generate-catalog ../packages/webgl/src/lib/components src/examples/components/webgl src/examples/catalog/webgl",
"generate:catalog": "layerstack-docs generate-catalog ../packages/layerchart/src/lib/components src/examples/components src/examples/catalog && layerstack-docs generate-catalog ../packages/webgl/src/lib/components src/examples/components src/examples/catalog/webgl && node scripts/prune-webgl-catalogs.mjs src/examples/catalog",
"generate:stackblitz": "layerstack-docs generate-stackblitz src static/stackblitz-files.json static/remote-sources.json --source src/lib/utils/data.ts=lib/utils/data.ts --source src/lib/utils/sports.ts=lib/utils/sports.ts --remote data.remote.ts=lib/data.remote.ts --remote geo.remote.ts=lib/geo.remote.ts --remote graph.remote.ts=lib/graph.remote.ts",
"generate:releases": "layerstack-docs generate-releases techniq/layerchart generated/releases",
"generate:all": "pnpm generate:api && pnpm generate:screenshots && pnpm generate:catalog && pnpm generate:stackblitz && pnpm generate:releases"
Expand All @@ -38,7 +38,7 @@
"@iconify-json/vscode-icons": "^1.2.53",
"@jsquash/webp": "^1.5.0",
"@layerchart/webgl": "workspace:*",
"@layerstack/docs": "1.0.0-next.7",
"@layerstack/docs": "1.0.0-next.10",
"@layerstack/svelte-actions": "1.0.1-next.20",
"@layerstack/svelte-state": "0.1.0-next.25",
"@layerstack/svelte-table": "1.0.1-next.20",
Expand Down
11 changes: 11 additions & 0 deletions docs/scripts/prune-webgl-catalogs.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// `@layerchart/webgl`'s catalogs are generated from every example, as LayerChart's are, but used only
// for its own components (ex. `Surface`): LayerChart's list every example of theirs (ex. `Points`),
// whichever package draws it. Removes its catalogs of components LayerChart has.
import fs from 'node:fs';
import path from 'node:path';

const [catalogDir = 'src/examples/catalog'] = process.argv.slice(2);
const webglDir = path.join(catalogDir, 'webgl');
for (const file of fs.readdirSync(webglDir)) {
if (fs.existsSync(path.join(catalogDir, file))) fs.rmSync(path.join(webglDir, file));
}
15 changes: 15 additions & 0 deletions docs/src/content/components/Arc.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ description: Primitive component which draws a curved segment on a chart to repr
category: primitives
layers: [svg, canvas]
related: [Pie, ArcChart, PieChart]
components:
- { name: Arc }
- { name: webgl/Arc, label: Arc (WebGL) }
---

::tip
Expand All @@ -24,3 +27,15 @@ The text will smartly orientate based on the direction (clockwise / counter-cloc
### Playground

:example{ name="playground" }

## WebGL

In a [`WebGL`](/docs/components/WebGL) layer, from [`@layerchart/webgl`](/docs/guides/webgl), it stands up by its z. See the [WebGL guide](/docs/guides/webgl) to get started.

An arc with the core [Arc](/docs/components/Arc) props: from `startAngle` to `endAngle` (ex. a slice from `d3.pie()`), or to a `value` through its `domain` and `range`, over a `track`. Radii are pixels, fractions of the chart's radius, or offsets from it, as the core are, and `class` styles it as on any core mark. It's centered in the plot (where the core draws inside a centered `Layer` or `Group`); `x` / `y` move it. `z` stands it up, as on an `isometric` chart; without one it lies flat.

:example{ name="pie" }

The core [concentric gauges](/docs/components/Arc/concentric) example, unchanged but for `z`:

:example{ name="concentric-3d" }
13 changes: 13 additions & 0 deletions docs/src/content/components/Area.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ description: Marking component which shades the space under a line on a chart to
category: marks
layers: [svg, canvas]
related: []
components:
- { name: Area }
- { name: webgl/Area, label: Area (WebGL) }
---

::info
Expand Down Expand Up @@ -40,3 +43,13 @@ This replaces grouping the data yourself and rendering an `Area` per group — e
On an [isometric](/docs/guides/isometric) chart, `z` gives each point a height, and an `Area` stands up as a curtain from the floor to those heights. One curtain per row of a band `y`, drawn back to front, makes a 3D ridgeline.

:example{ name="oscilloscope-ridgeline-isometric" }

## WebGL

In a [`WebGL`](/docs/components/WebGL) layer, from [`@layerchart/webgl`](/docs/guides/webgl), it lies on the floor, or rises as a curtain with a z. See the [WebGL guide](/docs/guides/webgl) to get started.

A curtain from the floor (or `z0`) up to `z` along the rows, one per group.

:example{ name="areas" }

:example{ name="ridgeline-3d" }
29 changes: 29 additions & 0 deletions docs/src/content/components/Axis.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ description: Commonly used component displays the scale and reference lines on a
category: common
layers: [svg, canvas, html]
related: [Grid, Rule]
components:
- { name: Axis }
- { name: webgl/Axis, label: Axis (WebGL) }
---

## Usage
Expand Down Expand Up @@ -328,3 +331,29 @@ Specify explicit time intervals such as every day, every 6 months, etc with comp
### Time scale (brush) with multiline ticks

:example{ name="time-scale-brush-multiline" } -->

## WebGL

In a [`WebGL`](/docs/components/WebGL) layer, from [`@layerchart/webgl`](/docs/guides/webgl), it runs along the plot box's edges: bottom for x, left for y, and back for z. See the [WebGL guide](/docs/guides/webgl) to get started.

Tick labels along an edge: `bottom` for `x`, `left` for `y`, and `back` for `z` (up the corner behind the plot). They keep to the edges in front as the view turns.

Labels are drawn on the plot box, turning with it: the floor's (`bottom`, `left`) lie on it, as on an [isometric](/docs/guides/isometric#text) chart, and the height axis' (`back`) stand on the back wall beside its edge. `tickLabelProps={{ viewport: true }}` and `labelProps={{ viewport: true }}` draw them facing the viewer instead, over the scene, upright and crisp however the view turns.

```svelte
<WebGL>
<Axis placement="bottom" label="x" />
<Axis
placement="left"
label="y"
tickLabelProps={{ viewport: true }}
labelProps={{ viewport: true }}
/>
<Axis placement="back" label="z" />
<Points />
</WebGL>
```

:example{ component="Points" name="scatter-3d" }

:example{ component="Spline" name="temperatures" }
39 changes: 39 additions & 0 deletions docs/src/content/components/Bars.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ description: Marking component which applies horizontal bars to represent and vi
category: marks
layers: [svg, canvas, html]
related: [Bar]
components:
- { name: Bars }
- { name: webgl/Bars, label: Bars (WebGL) }
---

:::tip
Expand All @@ -24,3 +27,39 @@ Use `width` or `height` to override the scale-derived size with a fixed pixel va
On an [isometric](/docs/guides/isometric) chart with `valueAxis="z"`, bars stand up off the floor as 3D columns, stacked by the chart.

:example{ component="Chart" name="isometric-stacked-columns" }

## WebGL

In a [`WebGL`](/docs/components/WebGL) layer, from [`@layerchart/webgl`](/docs/guides/webgl), each bar is a box standing as tall as its z. See the [WebGL guide](/docs/guides/webgl) to get started.

A box per row, standing on its `x` × `y` band cell, as tall as its `z`.

```svelte
<Chart
{data}
x="week"
xScale={scaleBand()}
y="day"
yScale={scaleBand()}
z="value"
view={perspective}
>
<WebGL>
<Bars tooltip />
</WebGL>
</Chart>
```

:example{ name="columns" }

### Stacked

With series and `valueAxis="z"`, bars stack up off the floor.

:example{ name="stacked-columns" }

### Heatmap and calendar

:example{ name="heatmap" }

:example{ name="calendar" }
25 changes: 25 additions & 0 deletions docs/src/content/components/Bin.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ description: Composite mark grouping two-dimensional points into a grid of hexag
category: marks
layers: [svg, canvas]
related: [GeoBin, Density, Contour, Cell, Points]
components:
- { name: Bin }
- { name: webgl/Bin, label: Bin (WebGL) }
---

::tip
Expand Down Expand Up @@ -88,3 +91,25 @@ To bin on the sphere instead — for a globe, or gridded data such as population
Pointer events receive the cell under the pointer.

:example{ name="tooltip" }

## WebGL

In a [`WebGL`](/docs/components/WebGL) layer, from [`@layerchart/webgl`](/docs/guides/webgl), each cell stands as tall as its z. See the [WebGL guide](/docs/guides/webgl) to get started.

Rows grouped into hexagons (or squares, or triangles) of the plot, or of the map as projected, as the core [Bin](/docs/components/Bin) groups them. Each cell stands up `z` tall (ex. its `count`), colored by its count unless given a `fill`. Every cell is the same shape, so thousands draw as one.

```svelte
<WebGL>
<Bin size={20} z="count" tooltip />
</WebGL>
```

:example{ name="hexbin" }

### On a map

:example{ name="walmart-3d" }

`weight` counts each row by a value (ex. the people in a cell of gridded population), and `gap` stands the cells apart.

:example{ name="state-population" }
11 changes: 11 additions & 0 deletions docs/src/content/components/Contour.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ description: Composite mark drawing isolines to delineate regions above and belo
category: marks
layers: [svg, canvas]
related: [Density, Hull, Raster, GeoPath]
components:
- { name: Contour }
- { name: webgl/Contour, label: Contour (WebGL) }
---

::tip
Expand Down Expand Up @@ -54,3 +57,11 @@ When no data is provided, the contour mark evaluates a continuous function _f_(_
Adjust thresholds and blur on a sampled function.

:example{ name="sampled-interactive" showCode }

## WebGL

In a [`WebGL`](/docs/components/WebGL) layer, from [`@layerchart/webgl`](/docs/guides/webgl), its lines lie flat or rise to their heights. See the [WebGL guide](/docs/guides/webgl) to get started.

Filled, it's LayerChart's own `Contour` (bands through the color scale, outlined with a `stroke`, and stacked into terraces when raised), drawn with WebGL marks. Unfilled (`fill="none"`), its lines lie at `z` pixels (ex. over a `Raster`), or each rises to its threshold's height with `z="value"`, in the bands' colors unless given a `stroke`. It takes values the same ways as [Surface](/docs/components/Surface).

:example{ name="basic" }
31 changes: 31 additions & 0 deletions docs/src/content/components/GeoPath.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ description: Geographic component which renders shapes such as countries, states
category: geo
layers: [svg, canvas]
related: [Graticule]
components:
- { name: GeoPath }
- { name: webgl/GeoPath, label: GeoPath (WebGL) }
---

:::tip
Expand All @@ -24,3 +27,31 @@ On an [isometric](/docs/guides/isometric) chart, `z` stands each shape up off th
Click a continent (or World Bank region) to zoom to its countries, a country for its states or provinces, then a region or US state for its provinces or counties. Clicking where there is nothing further in zooms back out a level. Each country's shapes load when it is clicked, from Natural Earth's [admin-1 states and provinces](https://www.naturalearthdata.com/downloads/10m-cultural-vectors/10m-admin-1-states-provinces/), with [US Atlas](https://github.com/topojson/us-atlas) for US counties.

:example{ name="geojson-drilldown" }

## WebGL

In a [`WebGL`](/docs/components/WebGL) layer, from [`@layerchart/webgl`](/docs/guides/webgl), features rise by their z, or follow a globe. See the [WebGL guide](/docs/guides/webgl) to get started.

Features on the floor through the chart's projection, extruded `z` tall (a property key or function of the feature, through the chart's `z` scale, or pixels). Lines, and outlines with `stroke`, draw on top. A collection draws as one mark, so thousands of features stay quick. `motion` eases each feature's height and fill to new values.

```svelte
<Chart geo={{ projection: geoAlbersUsa, fitGeojson: states }} view={perspective}>
<WebGL>
<GeoPath geojson={states} z={(d) => d.properties.population} fill="var(--color-primary)" />
</WebGL>
</Chart>
```

:example{ name="election" }

### Buildings, with shadows

d3-geo reads a polygon's outside ring clockwise, and the other way round as the rest of the world, so rewind rings from other sources (ex. OpenStreetMap) before drawing them.

:example{ component="Light" name="buildings" }

### On a globe

With the `globe` projection, features' lines draw over the sphere, and `{ type: 'Sphere' }` fills the globe itself (ex. beneath an image still loading).

:example{ component="GeoRaster" name="globe-tiles" }
Loading
Loading