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:
Interpolator |
Operation |
---|---|
|
Straight lines between points |
|
Closes the line segment, last point to first, making a polygon |
|
Step-wise drawing vertically then horizontally |
|
Step-wise drawing horizontally then vertically |
|
Renders a b-spline curve with control points at the ends |
|
Renders a b-spline curve with control points at the ends, not closing the... |