smoothPath

Chart
stable

Generate a Catmull-Rom spline SVG path string through an array of [x, y] points. Falls back to a straight polyline when fewer than 3 points are provided.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

Uses a tension of 0.5 (Catmull-Rom to Bezier conversion). May overshoot near sharp peaks — documented in OrigamChart.

API

Paramètres

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

points
requis
Array<TPathPoint>
Ordered array of [x, y] tuples defining the data points. At least 3 are required for the spline; fewer fall back to linePath.

API

Valeur de retour

La valeur retournée par cet util.

An SVG path data string starting with M and using C cubic Bezier commands for smooth curves.

Usage

Exemples

Extraits de code prêts à coller.

Render a smooth chart line

typescript