# polyline

The polyline SVG element is an SVG basic shape that creates straight lines connecting several points. Typically a polyline is used to create open shapes as the last point doesn't have to be connected to the first point. For closed shapes see the polygon element.

Usually, this element is create with:

const polyline = parentElement.add('polyline')

It's possible create as a disconnected element with gySVG('polyline') and attach it to the SVG document with .attachTo().

More info: mdn (opens new window) | w3c (opens new window)

# .points()

polyline.points( _ )

Set this attribute defines the list of points (pairs of x,y absolute coordinates) required to draw the polyline

  • argument: {} _

  • returns: {gySVGObject} The original object

const points = element.points();

Get the points current value.

  • returns: {}

# .pathLength()

polyline.pathLength( _ )

Set this attribute lets specify the total length for the path, in user units.

  • argument: {} _

  • returns: {gySVGObject} The original object

const pathLength = element.pathLength();

Get the pathLength current value.