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

Full TypeScript signature sourced from the util file.

typescript

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

API

Parameters

Input parameters accepted by this util.

points
required
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

Return value

The value returned by this util.

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

Usage

Examples

Ready-to-paste usage snippets.

Render a smooth chart line

typescript