Data Curve Functions
These functions are used for working with data curves.
| Function | Versions | Description |
|---|---|---|
addCurve | 2.2+ | Adds a new data curve to a project. |
deleteCurve | 2.2+ | Deletes a data curve from a project. |
getCurveIndex | 2.2+ | Retrieves the index of a curve given its ID name. |
getCurveId | 2.2+ | Retrieves the ID name of a curve given its index. |
setCurveId | 2.2+ | Changes the ID name of a data curve given its index. |
getCurveLenth | 2.2+ | Retrieves the number of points in a curve. |
getCurveType | 2.2+ | Retrieves a curve’s type. |
setCurveType | 2.3+ | Changes a curve’s classification. |
getCurveValue | 2.2+ | Retrieves the value of a single data point for a curve. |
setCurveValue | 2.2+ | Sets the value of a single data point for a curve. |
setCurve | 2.2+ | Assigns a set of data points to a curve. |
addCurve 2.2+
Section titled “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 2.2+
Section titled “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 2.2+
Section titled “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 2.2+
Section titled “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 2.2+
Section titled “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 2.2+
Section titled “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 2.2+
Section titled “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).
setCurveType 2.3+
Section titled “setCurveType ”Reassigns the type of an existing curve (e.g. pump-head vs. efficiency vs. volume curve).
setCurveType(index: number, type: CurveType): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| index | number | a curve’s index (starting from 1). |
| type | CurveType | the new curve type (see CurveType). |
getCurveValue 2.2+
Section titled “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 2.2+
Section titled “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 2.2+
Section titled “setCurve ”Assigns a set of data points to a curve.
setCurve(index: number, xValues: number[], yValues: number[]): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| index | number | 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.