addPoint(point, [insertAt])

Class: Polyline.

Description:

Adds a point to the Polyline as a last point or at a specified index.

Parameters:

Name Type Description

point

Point

A Point formatted object with X and Y coordinates (e.g., {x: 20, y:30});

[insertAt]

number

If specified, the point will be added at this position; otherwise at the end.

Returns:

Returns this Polyline shape object for chaining.

Type: Polyline

Examples:

Adding a point to the end of the points array:

polyline.addPoint({x:20, y:30});

Adding a point at a specified index:

polyline.addPoint({x:30, y:60}, 0); // adds a point the beginning of points array

Also See: