Skip to content

Class: Plot3D ​

Defined in: plot3d/plot3d.ts:113

A 3D scatter/surface plot with an orbit camera, axis ticks, and lighting.

Constructors ​

Constructor ​

ts
new Plot3D(container, options?): Plot3D;

Defined in: plot3d/plot3d.ts:184

Parameters ​

ParameterType
containerHTMLElement
optionsPlot3DOptions

Returns ​

Plot3D

Methods ​

addBar3D() ​

ts
addBar3D(opts): Bar3DLayer;

Defined in: plot3d/plot3d.ts:349

3D bars (columns) on an x/z grid, lit and optionally colormapped.

Parameters ​

ParameterType
optsBar3DOptions

Returns ​

Bar3DLayer


addBoxes3D() ​

ts
addBoxes3D(opts): Boxes3DLayer;

Defined in: plot3d/plot3d.ts:359

Independently sized lit cuboids (voxels, bounding boxes, model layer blocks).

Parameters ​

ParameterType
optsBoxes3DOptions

Returns ​

Boxes3DLayer


addContour3D() ​

ts
addContour3D(opts): Contour3DLayer;

Defined in: plot3d/plot3d.ts:388

3D iso-height contour lines of a grid, stacked at their level heights.

Parameters ​

ParameterType
optsContour3DOptions

Returns ​

Contour3DLayer


addIsosurface() ​

ts
addIsosurface(opts): IsosurfaceLayer;

Defined in: plot3d/plot3d.ts:397

A marching-cubes isosurface of a 3D scalar volume (lit, solid-colored).

Parameters ​

ParameterType
optsIsosurfaceOptions

Returns ​

IsosurfaceLayer


addLabel3D() ​

ts
addLabel3D(label): () => void;

Defined in: plot3d/plot3d.ts:420

Pin a text label to a point in data space. It is re-projected every frame, so it tracks the point as the camera orbits. Returns a disposer that removes just this label.

Parameters ​

ParameterType
labelLabel3D

Returns ​

() => void


addLine3D() ​

ts
addLine3D(opts): Line3DLayer;

Defined in: plot3d/plot3d.ts:340

A 3D polyline / path.

Parameters ​

ParameterType
optsLine3DOptions

Returns ​

Line3DLayer


addPointCloud() ​

ts
addPointCloud(opts): PointCloudLayer;

Defined in: plot3d/plot3d.ts:331

Parameters ​

ParameterType
optsPointCloudOptions

Returns ​

PointCloudLayer


addQuiver3D() ​

ts
addQuiver3D(opts): Quiver3DLayer;

Defined in: plot3d/plot3d.ts:379

A 3D vector field (arrows), optionally colored by magnitude.

Parameters ​

ParameterType
optsQuiver3DOptions

Returns ​

Quiver3DLayer


addSurface() ​

ts
addSurface(opts): SurfaceLayer;

Defined in: plot3d/plot3d.ts:322

Parameters ​

ParameterType
optsSurfaceOptions

Returns ​

SurfaceLayer


addVolume() ​

ts
addVolume(opts): VolumeLayer;

Defined in: plot3d/plot3d.ts:407

Direct volume rendering (GPU raymarch) of a 3D scalar field.

Parameters ​

ParameterType
optsVolumeOptions

Returns ​

VolumeLayer


clearLabels3D() ​

ts
clearLabels3D(): void;

Defined in: plot3d/plot3d.ts:433

Remove every data-space label.

Returns ​

void


copyToClipboard() ​

ts
copyToClipboard(opts?): Promise<void>;

Defined in: plot3d/plot3d.ts:589

Copy the current view to the clipboard as a PNG.

Parameters ​

ParameterType
optsExportOptions

Returns ​

Promise<void>


destroy() ​

ts
destroy(): void;

Defined in: plot3d/plot3d.ts:603

Returns ​

void


downloadImage() ​

ts
downloadImage(
   filename?, 
   type?, 
opts?): Promise<void>;

Defined in: plot3d/plot3d.ts:584

Download the current view as an image (PNG by default).

Parameters ​

ParameterTypeDefault value
filenamestring"chart.png"
typestring"image/png"
optsExportOptions{}

Returns ​

Promise<void>


isOnScreen() ​

ts
isOnScreen(): boolean;

Defined in: plot3d/plot3d.ts:599

Whether this chart is currently on screen (plus a small margin), as offscreenCulling judges it. Photon already skips its own drawing while a chart is out of view; a streaming app should check this before regenerating data and calling setData, which uploads to the GPU regardless.

Returns ​

boolean


refresh() ​

ts
refresh(): void;

Defined in: plot3d/plot3d.ts:550

Re-fit the axes to the data and redraw — call after a layer's setData(...).

Returns ​

void


removeLayer() ​

ts
removeLayer(layer): void;

Defined in: plot3d/plot3d.ts:539

Remove a layer, re-fit, and redraw.

Parameters ​

ParameterType
layerLayer3D

Returns ​

void


render() ​

ts
render(): void;

Defined in: plot3d/plot3d.ts:774

Returns ​

void


requestRender() ​

ts
requestRender(): void;

Defined in: plot3d/plot3d.ts:717

Returns ​

void


resetView() ​

ts
resetView(): void;

Defined in: plot3d/plot3d.ts:471

Restore the initial camera orientation and zoom.

Returns ​

void


setAutoRotate() ​

ts
setAutoRotate(speed): void;

Defined in: plot3d/plot3d.ts:457

Auto-orbit the camera. true = default speed, number = radians/frame, false/0 stops.

Parameters ​

ParameterType
speednumber | boolean

Returns ​

void


setLight() ​

ts
setLight(params): void;

Defined in: plot3d/plot3d.ts:440

Update the light direction (azimuth/elevation, radians) and ambient (0..1).

Parameters ​

ParameterType
params{ ambient?: number; azimuth?: number; elevation?: number; }
params.ambient?number
params.azimuth?number
params.elevation?number

Returns ​

void


toBlob() ​

ts
toBlob(type?, opts?): Promise<Blob | null>;

Defined in: plot3d/plot3d.ts:579

Export the current view as a Blob (default PNG).

Parameters ​

ParameterTypeDefault value
typestring"image/png"
optsExportOptions{}

Returns ​

Promise<Blob | null>


toDataURL() ​

ts
toDataURL(type?, opts?): string;

Defined in: plot3d/plot3d.ts:574

Export the current view as a data URL (default PNG).

Parameters ​

ParameterTypeDefault value
typestring"image/png"
optsExportOptions{}

Returns ​

string

MIT licensed. WebGL2 required.