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
Full TypeScript signature sourced from the util file.
API
Parameters
Input parameters accepted by this util.
- pointsrequiredArray<TPathPoint>
- Ordered array of [x, y] tuples representing the data series.
- baselineYrequirednumber
- Y coordinate of the bottom baseline (e.g. the chart zero line or the bottom of the viewport).
- smoothboolean | 'monotone' | 'stepped'false
- Smoothing strategy. false = straight segments, true = Catmull-Rom Bezier, "monotone" = Fritsch-Carlson (no overshoots), "stepped" = staircase.
API
Return value
The value returned by this util.
- SVG path data string for the filled area, closed at the baseline. Returns an empty string when the points array is empty.
Usage
Examples
Ready-to-paste usage snippets.
Monotone area path