d3.curveCatmullRom is a D3 curve factory that generates a smooth, flexible Catmull–Rom cubic spline passing through supplied data points. Apply it through a generator’s curve() accessor. section 4.2.2
Choose the interpolation based on how faithfully the curve should represent the data:
- Use it with d3.line() when a line chart needs interpolation between discrete points. section 4.2.2
- Compare its result with other interpolation functions because smoothing changes the visual representation of the data. section 4.2.2
- Keep the data points visible when accuracy matters; a smooth curve can otherwise suggest values the data does not support. section 4.2.2
- Use it with d3.area() to curve the upper and lower boundaries of streamgraph or stacked-area series. section 5.2.3
Curving a streamgraph
Configure an area generator with x(), y0(), and y1() accessors, then chain .curve(d3.curveCatmullRom). Bind the resulting generator to SVG paths for each stacked series.
