steppedPathLength

Chart
stable

Compute the total Manhattan-distance length of a stepped SVG path. Each pair of points contributes |Δx| + |Δy| (not the Euclidean diagonal), matching the true rendered stroke length of a stepped-line chart.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

points
required
Array<TPathPoint>
Ordered array of [x, y] tuples that describe the vertices of the stepped path.

API

Return value

The value returned by this util.

Total Manhattan length in the same coordinate unit as the input points. Returns 0 when fewer than 2 points are supplied.

Usage

Examples

Ready-to-paste usage snippets.

Drive a stroke-dasharray animation

typescript