Skip to content

Data Curve Functions

These functions are used for working with data curves.

FunctionDescription
addCurveAdds a new data curve to a project.
deleteCurveDeletes a data curve from a project.
getCurveIndexRetrieves the index of a curve given its ID name.
getCurveIdRetrieves the ID name of a curve given its index.
setCurveIdChanges the ID name of a data curve given its index.
getCurveLenthRetrieves the number of points in a curve.
getCurveTypeRetrieves a curve’s type.
getCurveValueRetrieves the value of a single data point for a curve.
setCurveValueSets the value of a single data point for a curve.
setCurveassigns a set of data points to a curve.

Adds a new data curve to a project.

addCurve(id: string): void;

Parameters

ParameterTypeDescription
idstringThe ID name of the curve to be added.

The new curve contains a single data point (1.0, 1.0).


Deletes a data curve from a project.

deleteCurve(index: number): void;

Parameters

ParameterTypeDescription
indexnumberthe data curve’s index (starting from 1).

Retrieves the index of a curve given its ID name.

getCurveIndex(id: string): number;

Parameters

ParameterTypeDescription
idstringthe ID name of a curve.

Returns

Number The curve’s index (starting from 1).


Retrieves the ID name of a curve given its index.

getCurveId(index: number): string;

Parameters

ParameterTypeDescription
indexnumbera curve’s index (starting from 1).

Returns

Number the curve’s ID name.


Changes the ID name of a data curve given its index.

setCurveId(index: number, id: string): void;

Parameters

ParameterTypeDescription
indexnumbera data curve index (starting from 1).
idstringthe data curve’s new ID name.

Retrieves the number of points in a curve.

getCurveLenth(index: number): number;

Parameters

ParameterTypeDescription
indexnumbera curve’s index (starting from 1).

Returns

Number The number of data points assigned to the curve.


Retrieves a curve’s type.

getCurveType(index: number): CurveType;

Parameters

ParameterTypeDescription
indexnumbera curve’s index (starting from 1).

Returns

CurveType the curve’s type (see CurveType).


Retrieves the value of a single data point for a curve.

getCurveValue(curveIndex: number, pointIndex: number): {
x: number;
y: number;
};

Parameters

ParameterTypeDescription
curveIndexnumbera curve’s index (starting from 1).
pointIndexnumberthe index of a point on the curve (starting from 1).

Returns

Object

{
x: number;
y: number;
}
PropertyTypeDescription
xnumberthe point’s x-value.
ynumberthe point’s y-value.

Sets the value of a single data point for a curve.

setCurveValue(curveIndex: number, pointIndex: number, x: number, y: number): void;

Parameters

ParameterTypeDescription
curveIndexnumbera curve’s index (starting from 1).
pointIndexnumberthe index of a point on the curve (starting from 1).
xnumberthe point’s new x-value.
ynumberthe point’s new y-value.

Assigns a set of data points to a curve.

setCurve(index: number, xValues: number[], yValues: number[]): void;

Parameters

ParameterTypeDescription
index a curve’s index (starting from 1).
xValuesnumber[]an array of new x-values for the curve.
yValuesnumber[]an array of new y-values for the curve.

Use this function to redefine (and resize) a curve all at once; use setCurveValue to revise a curve’s data points one at a time.