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

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

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

API

Valeur de retour

La valeur retournée par cet util.

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

Usage

Exemples

Extraits de code prêts à coller.

Drive a stroke-dasharray animation

typescript