WebglLine

The standard Line class

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

+ new WebglLine(c: ColorRGBA, numPoints: number): WebglLine

Overrides WebglBaseLine.constructor

Defined in src/WbglLine.ts:7

Create a new line

example

x = [0, 1];
y = [1, 2];
line = new WebglLine(new ColorRGBA(0.1, 0.1, 0.1, 1), 2);

Parameters:

NameTypeDescription
cColorRGBAthe color of the line
numPointsnumbernumber of data pints

Returns: WebglLine

Properties

color

• color: ColorRGBA

Inherited from WebglBaseLine.color

Defined in src/WebglBaseLine.ts:24

The Color of the line


intensity

• intensity: number

Inherited from WebglBaseLine.intensity

Defined in src/WebglBaseLine.ts:7


loop

• loop: boolean

Inherited from WebglBaseLine.loop

Defined in src/WebglBaseLine.ts:54

if this is a close loop line or not

default = false


numPoints

• numPoints: number

Inherited from WebglBaseLine.numPoints

Defined in src/WebglBaseLine.ts:13

The number of data point pairs in the line


offsetX

• offsetX: number

Inherited from WebglBaseLine.offsetX

Defined in src/WebglBaseLine.ts:42

The horixontal offset of the line

default = 0


offsetY

• offsetY: number

Inherited from WebglBaseLine.offsetY

Defined in src/WebglBaseLine.ts:48

the vertical offset of the line

default = 0


scaleX

• scaleX: number

Inherited from WebglBaseLine.scaleX

Defined in src/WebglBaseLine.ts:30

The horizontal scale of the line

default = 1


scaleY

• scaleY: number

Inherited from WebglBaseLine.scaleY

Defined in src/WebglBaseLine.ts:36

The vertical sclae of the line

default = 1


visible

• visible: boolean

Inherited from WebglBaseLine.visible

Defined in src/WebglBaseLine.ts:8


webglNumPoints

• webglNumPoints: number

Inherited from WebglBaseLine.webglNumPoints

Defined in src/WebglBaseLine.ts:60

total webgl number of points

internal


xy

• xy: Float32Array

Inherited from WebglBaseLine.xy

Defined in src/WebglBaseLine.ts:19

The data ponits for webgl array

internal

Methods

constY

â–¸ constY(c: number): void

Defined in src/WbglLine.ts:85

Set a constant value for all Y values in the line

Parameters:

NameTypeDescription
cnumberconstant value

Returns: void


getX

â–¸ getX(index: number): number

Defined in src/WbglLine.ts:50

Get an X value at a specific index

Parameters:

NameTypeDescription
indexnumberthe index of X

Returns: number


getY

â–¸ getY(index: number): number

Defined in src/WbglLine.ts:58

Get an Y value at a specific index

Parameters:

NameTypeDescription
indexnumberthe index of Y

Returns: number


lineSpaceX

â–¸ lineSpaceX(start: number, stepSize: number): void

Defined in src/WbglLine.ts:74

Make an equally spaced array of X points

example

//x = [-1, -0.8, -0.6, -0.4, -0.2, 0, 0.2, 0.4, 0.6, 0.8]
const numX = 10;
line.lineSpaceX(-1, 2 / numX);

Parameters:

NameTypeDescription
startnumberthe start of the series
stepSizenumberstep size between each data point

Returns: void


setX

â–¸ setX(index: number, x: number): void

Defined in src/WbglLine.ts:33

Set the X value at a specific index

Parameters:

NameTypeDescription
indexnumberthe index of the data point
xnumberthe horizontal value of the data point

Returns: void


setY

â–¸ setY(index: number, y: number): void

Defined in src/WbglLine.ts:42

Set the Y value at a specific index

Parameters:

NameTypeDescription
indexnumber: the index of the data point
ynumber: the vertical value of the data point

Returns: void


shiftAdd

â–¸ shiftAdd(data: Float32Array): void

Defined in src/WbglLine.ts:102

Add a new Y values to the end of current array and shift it, so that the total number of the pair remains the same

example

yArray = new Float32Array([3, 4, 5]);
line.shiftAdd(yArray);

Parameters:

NameTypeDescription
dataFloat32Arraythe Y array

Returns: void