areaPath

Chart
stable

Build an SVG closed area path from a series of [x, y] points and a baseline Y value. Supports four smoothing modes: straight lines, Catmull-Rom, Fritsch-Carlson monotone, and stepped.

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 representing the data series.
baselineY
requis
number
Y coordinate of the bottom baseline (e.g. the chart zero line or the bottom of the viewport).
smooth
boolean | 'monotone' | 'stepped'
false
Smoothing strategy. false = straight segments, true = Catmull-Rom Bezier, "monotone" = Fritsch-Carlson (no overshoots), "stepped" = staircase.

API

Valeur de retour

La valeur retournée par cet util.

SVG path data string for the filled area, closed at the baseline. Returns an empty string when the points array is empty.

Usage

Exemples

Extraits de code prêts à coller.

Monotone area path

typescript