line, spline

March 20, 2014

D3 lines are rendered using linear interpolation by default. This means that the line connecting a series of points will trace a direct path from one node to another:

The curved line is rendered with the cardinal interpolator, one of several options D3 provides. The curvature of the line is called a spline. Splines are tools used by architects to draw curved lines, and the term was adopted by mathematicians to describe smooth, piecewise polynomial approximation:

Splines are curves, which are usually required to be continuous and smooth… [The] join points are called knots. Splines with few knots are generally smoother than splines with many knots; however, increasing the number of knots usually increases the fit of the spline function to the data. Knots give the curve freedom to bend to more closely follow the data. —Wikipedia


Mostly Katie explaining things to herself.

© 2022