monotonePath

Chart
stable

Generates a smooth SVG cubic-Bezier path through pixel coordinates using the Fritsch-Carlson monotone spline algorithm. Produces no overshoot at sharp peaks. Falls back to linePath for fewer than 3 points.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

points
required
Array<TPathPoint>
Array of pre-scaled SVG pixel coordinate pairs [x, y]. A minimum of 3 points is required for the spline; smaller arrays fall back to linePath.

API

Return value

The value returned by this util.

SVG path d attribute string with cubic Bezier commands (C). Falls back to the M…L… output of linePath when fewer than 3 points are supplied.

Usage

Examples

Ready-to-paste usage snippets.

Smooth spline through data points

typescript