linePath

Chart
stable

Converts an array of pre-scaled [x, y] pixel coordinates into an SVG path string using straight line segments (M…L…). Returns an empty string for an empty array.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

points
required
Array<TPathPoint>
Array of pre-scaled SVG pixel coordinate pairs [x, y]. The first point becomes the M command; subsequent points become L commands.

API

Return value

The value returned by this util.

SVG path d attribute string (e.g. "M0,0 L10,10 L20,5"). Empty string when points is empty.

Usage

Examples

Ready-to-paste usage snippets.

Build a straight-line SVG path

typescript