May 2019
Beginner to intermediate
650 pages
14h 50m
English
Curve factory functions change the way a line is interpolated between data points. The default factory for new lines and areas is d3.curveLinear, but that can be overridden by calling the .curve() method with one of the factories illustrated and listed in the diagram that follows:

For example, the following code will replace the straight line segments with a monotonic curve in relation to the x axis:
const line = d3.line() .x(d => scaleX(d[0])) .y(d => scaleY(d[1])) .curve(d3.curveMonotoneX);
Three types of curve can be fine-tuned with additional methods:
Read now
Unlock full access