pathLength
Chart
stable
Compute the total Cartesian length of a polyline defined by an ordered array of `[x, y]` points. Used to seed `stroke-dasharray` / `stroke-dashoffset` for the chart line-drawing entrance animation.
API
Signature
Full TypeScript signature sourced from the util file.
API
Parameters
Input parameters accepted by this util.
- pointsrequiredArray<TPathPoint>
- An ordered array of `[x, y]` coordinate pairs defining the polyline. Returns `0` for arrays with fewer than 2 points.
API
Return value
The value returned by this util.
- Total Euclidean length of the polyline in SVG user units. Returns `0` when the array has fewer than 2 points.
Usage
Examples
Ready-to-paste usage snippets.
Measure a simple two-segment path