Line Chart 3D

Lines through a box, a point of the data after another.

-10-50510-10-50510-10-50510-10-50510051015202530051015202530051015202530051015202530-10-50510-10-50510-10-50510-10-50510
Strand A
Strand B

The entries of data are points in space, joined in the order of the data: a trajectory, a spiral, a walk. series names the field that tells the lines apart. Pointing at a line lights the point nearest the pointer, with a dot on it, and the tooltip reads that point. For entries along x with a value per series - the line chart of a spreadsheet - see the area chart.

Installation

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

Update

Press Update: the points glide to their new positions over the animationDuration of the container, the line between them follows, and the axes scale along.

-101234-101234-101234-101234-6-4-2024-6-4-2024-6-4-2024-6-4-2024-4-3-2-101-4-3-2-101-4-3-2-101-4-3-2-101

Enter and leave

With an id field, a point follows its name through updates: a new one unfolds from the point before it on its line - from the one after it, at the start - as it fades in, a gone one folds back into it - the mirror of its entering - and one that moves glides (see Enter in the glossary). So a line grows at its end as the data gains a point, and shrinks from its start as it loses one. Without an id, points are named by their position in data, which animates appending and removing at the end. A line that is all new stands in place and fades in. Data may come faster than the line glides, as from a feed: every point goes on from where it is, a new one starting on the point before it wherever that has come to.

-6-4-2024-6-4-2024-6-4-2024-6-4-20240123456012345601234560123456-8-6-4-20246-8-6-4-20246-8-6-4-20246-8-6-4-20246

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.

-10-50510-10-50510-10-50510-10-50510051015202530051015202530051015202530051015202530-10-50510-10-50510-10-50510-10-50510
SVG
-10-50510-10-50510-10-50510-10-50510051015202530051015202530051015202530051015202530-10-50510-10-50510-10-50510-10-50510
Canvas

Many marks

The Lorenz attractor, three thousand points of it - 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. colors names two config keys, and each point's part of the line takes the color of its height on the ramp between them, in place of the color of its series.

-20-1001020-20-1001020-20-1001020-20-100102001020304050010203040500102030405001020304050-30-20-100102030-30-20-100102030-30-20-100102030-30-20-100102030

Gaps

An entry whose x, y or z is missing or not a number has no point, and its line stops before it and starts again after it: no segment bridges a value the data does not have. A point alone between two gaps is a circle as wide as the line.

API Reference

Prop

Type

Edit on GitHub

On this page