Skip to content

Data Curve Functions

These functions are used for working with data curves.

Function Description
addCurve Adds a new data curve to a project.
deleteCurve Deletes a data curve from a project.
getCurveIndex Retrieves the index of a curve given its ID name.
getCurveId Retrieves the ID name of a curve given its index.
setCurveId Changes the ID name of a data curve given its index.
getCurveLenth Retrieves the number of points in a curve.
getCurveType Retrieves a curve's type.
getCurveValue Retrieves the value of a single data point for a curve.
setCurveValue Sets the value of a single data point for a curve.
setCurve assigns a set of data points to a curve.

addCurve

Adds a new data curve to a project.

addCurve(id: string): void;

Parameters

Parameter Type Description
id string The ID name of the curve to be added.

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


deleteCurve

Deletes a data curve from a project.

deleteCurve(index: number): void;

Parameters

Parameter Type Description
index number the data curve's index (starting from 1).

getCurveIndex

Retrieves the index of a curve given its ID name.

getCurveIndex(id: string): number;

Parameters

Parameter Type Description
id string the ID name of a curve.

Returns

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


getCurveId

Retrieves the ID name of a curve given its index.

getCurveId(index: number): string;

Parameters

Parameter Type Description
index number a curve's index (starting from 1).

Returns

Number the curve's ID name.


setCurveId

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

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

Parameters

Parameter Type Description
index number a data curve index (starting from 1).
id string the data curve's new ID name.

getCurveLenth

Retrieves the number of points in a curve.

getCurveLenth(index: number): number;

Parameters

Parameter Type Description
index number a curve's index (starting from 1).

Returns

Number The number of data points assigned to the curve.


getCurveType

Retrieves a curve's type.

getCurveType(index: number): CurveType;

Parameters

Parameter Type Description
index number a curve's index (starting from 1).

Returns

CurveType the curve's type (see CurveType).


getCurveValue

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

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

Parameters

Parameter Type Description
curveIndex number a curve's index (starting from 1).
pointIndex number the index of a point on the curve (starting from 1).

Returns

Object

{
  x: number;
  y: number;
}
Property Type Description
x number the point's x-value.
y number the point's y-value.

setCurveValue

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

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

Parameters

Parameter Type Description
curveIndex number a curve's index (starting from 1).
pointIndex number the index of a point on the curve (starting from 1).
x number the point's new x-value.
y number the point's new y-value.

setCurve

Assigns a set of data points to a curve.

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

Parameters

Parameter Type Description
index a curve's index (starting from 1).
xValues number[] an array of new x-values for the curve.
yValues number[] 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.