Skip to content

3D charts

Surface mesh ​

scenes/surface-mesh
plot.setGraph({
  domain: [-8, 8, -8, 8, -8, 8],
  labels: ["x", "y", "z"],
  resolution: [120, 120],
  plots: [{ name: equation, equation }],
});
plot.frameScene();

Calls

2 in the code above, in the order it makes them

plot.setGraph(graph: Graph): void

Draw a document of mathematical plots: expressions, curves, imported tables, and the labelled axis frame around them.

Replaces whatever graph was set before, and leaves uploaded geometry alone, so a generated surface can sit beside a point cloud under the same camera.

This is the expensive call: every plot in the document is regenerated and re-uploaded. Drawing one afterwards is not. A page with a slider over an expression's parameter should expect the cost of a keystroke, not the cost of a frame, which is why the examples keep their documents small.

plot.frameScene(): void

Point the camera at the middle of everything uploaded, far enough back to see it.

Call after uploading. A scene measured in grid cells or in millimetres is nowhere near where a camera starts, and without this the first thing a caller sees is an empty canvas.