Appearance
Data and streaming
Analyses (frames, measurements, statistics)
The calls
plot.analyses(index: number): AnalysisOffer[]What the plot at
indexwill accept being asked.Depends on what the plot is: a curve offers derivatives, integrals and moving frames; a surface offers curvature, area and mesh quality; a table offers statistics and data checks. Asking for one that is not offered throws rather than returning something meaningless.
plot.analyse(index: number, kind: string, options?: { readonly against?: number; readonly parameters?: Readonly<Record<string, string>>; }): AnalysisRun an analysis on the plot at
index.options.againstnames a second plot for the three analyses that read a curve against a surface;analysessays which need one.options.parametersare the analysis's own, as strings, because an analysis parses what it needs by name.
plot.setGraph({ plots: [{ name: "surface", equation: "z = sin(x) * cos(y)" }] });
plot.frameScene();
// What this plot can be asked. A curve and a surface are offered
// different things.
const offered = plot.analyses(0);
const area = plot.analyse(0, "surfaceArea");
const [name, value] = area.reports[0]?.values[0] ?? ["area", "?"];
return { readout: `${offered.length} analyses offered; ${name} ${value}` };Also called
2 in the code above, in the order it makes them
plot.setGraph(graph: Graph): voidDraw 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(): voidPoint 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.