Drawing line graphs using interpolators

Now let's examine creating line graphs using a number of the built-in line generators. The capability for rendering lines in D3.js is very robust, and can be used to generate lines with straight segments, or to fit curves through a series of points using a number of different algorithms.

When rendering a line using a line generator, D3.js applies an interpolator across your data to determine how to create the path segments that connect your data points. The following tables lists the available line interpolators that are available:




Straight lines between points


Closes the line segment, last point to first, making a polygon


Step-wise drawing ...

Get D3.js: Cutting-edge Data Visualization now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.