Surface Chart 3D

A shaded surface over a grid of heights.

-4-2024-4-2024-4-2024-4-2024-1-0.500.51-1-0.500.51-1-0.500.51-1-0.500.51-4-2024-4-2024-4-2024-4-2024

Every 2 × 2 heights side by side make a quad of the surface, so a grid needs at least two rows and two columns: a single row, column or cell draws the box and no surface.

Uneven spacing

Where the columns or rows were not measured at even steps, x and z name the value of each: here a lake sampled on the days the boat went out, at the depths of its sensors. The surface joins the columns and the rows in the order of the data, so give them ascending; a column or row without a finite value drops out, and its neighbours join.

01020304050day01020304050day01020304050day01020304050day4 °C6 °C8 °C10 °C12 °C14 °C16 °C18 °Ctemperature4 °C6 °C8 °C10 °C12 °C14 °C16 °C18 °Ctemperature4 °C6 °C8 °C10 °C12 °C14 °C16 °C18 °Ctemperature4 °C6 °C8 °C10 °C12 °C14 °C16 °C18 °Ctemperature0 m5 m10 m15 m20 mdepth0 m5 m10 m15 m20 mdepth0 m5 m10 m15 m20 mdepth0 m5 m10 m15 m20 mdepth

Installation

npx shadcn@latest add niekes/chart3dcn/surface-chart-3d#v1.2.0

Update

Press Update: the surface morphs into the new wave over the animationDuration of the container, and its color ramp follows the heights.

-4-2024-4-2024-4-2024-4-2024-1-0.500.51-1-0.500.51-1-0.500.51-1-0.500.51-4-2024-4-2024-4-2024-4-2024

Enter and leave

The grid may grow and shrink. Coming and going is a fade in place: new border cells fade in where they belong while the axes make room - held inside the box until there is room for them - and shrunken away, they fade out where they stand, inside the box, and leave when the glide is done - the mirror of their entering (see Enter in the glossary). The surface itself never moves where data merely appears or disappears.

01234567012345670123456701234567-1-0.500.51-1-0.500.51-1-0.500.51-1-0.500.5101234567012345670123456701234567

Renderers

The same chart on every renderer, side by side. The marks are data the chart hands to the container, and "svg" and "canvas" draw them all - where the browser has no canvas, as SVG.

-4-2024-4-2024-4-2024-4-2024-1-0.500.51-1-0.500.51-1-0.500.51-1-0.500.51-4-2024-4-2024-4-2024-4-2024
SVG
-4-2024-4-2024-4-2024-4-2024-1-0.500.51-1-0.500.51-1-0.500.51-1-0.500.51-4-2024-4-2024-4-2024-4-2024
Canvas

Many marks

An 80 by 80 grid, over six thousand cells - and the chart stays interactive. The scene is one list of marks, so the demo starts on "canvas", the renderer for many marks, and the select shows the same scene on SVG.

-10-50510-10-50510-10-50510-10-50510-1.5-1-0.500.511.5-1.5-1-0.500.511.5-1.5-1-0.500.511.5-1.5-1-0.500.511.5-10-50510-10-50510-10-50510-10-50510

API Reference

Prop

Type

Edit on GitHub

On this page