Generates a line for the given array of data. Depending on this line generator’s associated curve, the given input data may need to be sorted by x-value before being passed to the line generator.
IMPORTANT: If the rendering context of the line generator is null, then the line is returned as a path data string.
Array of data elements.
Generates a line for the given array of data. Depending on this line generator’s associated curve, the given input data may need to be sorted by x-value before being passed to the line generator.
IMPORTANT: If the line generator has been configured with a rendering context, then the line is rendered to this context as a sequence of path method calls and this function returns void.
Array of data elements.
Returns the current rendering context, which defaults to null.
Sets the context and returns this line generator.
Returns the current curve factory, which defaults to curveLinear.
Returns the current curve factory, which defaults to curveLinear.
The generic allows to cast the curve factory to a specific type, if known.
Sets the curve factory and returns this line generator.
A valid curve factory.
Returns the current defined accessor, which defaults to a function returning a constant boolean value of true.
Returns the current defined accessor, which defaults to a function returning a constant boolean value of true.
Sets the defined accessor to the specified boolean and returns this line generator.
The default accessor for defined returns a constant boolean value of true, thus assumes that the input data is always defined.
When a line is generated, the defined accessor will be invoked for each element in the input data array, being passed the element d, the index i, and the array data as three arguments. If the given element is defined (i.e., if the defined accessor returns a truthy value for this element), the x and y accessors will subsequently be evaluated and the point will be added to the current line segment. Otherwise, the element will be skipped, the current line segment will be ended, and a new line segment will be generated for the next defined point. As a result, the generated line may have several discrete segments.
Note that if a line segment consists of only a single point, it may appear invisible unless rendered with rounded or square line caps. In addition, some curves such as curveCardinalOpen only render a visible segment if it contains multiple points.
A boolean constant.
Sets the defined accessor to the specified function and returns this line generator.
The default accessor for defined returns a constant boolean value of true, thus assumes that the input data is always defined.
When a line is generated, the defined accessor will be invoked for each element in the input data array, being passed the element d, the index i, and the array data as three arguments. If the given element is defined (i.e., if the defined accessor returns a truthy value for this element), the x and y accessors will subsequently be evaluated and the point will be added to the current line segment. Otherwise, the element will be skipped, the current line segment will be ended, and a new line segment will be generated for the next defined point. As a result, the generated line may have several discrete segments.
Note that if a line segment consists of only a single point, it may appear invisible unless rendered with rounded or square line caps. In addition, some curves such as curveCardinalOpen only render a visible segment if it contains multiple points.
An accessor function which returns a boolean value. The accessor will be invoked for each defined element in the input data array, being passed the element d, the index i, and the array data as three arguments.
Returns the current x-coordinate accessor function, which defaults to a function returning first element of a two-element array of numbers.
Returns the current x-coordinate accessor function, which defaults to a function returning first element of a two-element array of numbers.
Sets the x accessor to the specified number and returns this line generator.
A constant x-coordinate value.
Sets the x accessor to the specified function and returns this line generator.
When a line is generated, the x accessor will be invoked for each defined element in the input data array.
The default x accessor assumes that the input data are two-element arrays of numbers. If your data are in a different format, or if you wish to transform the data before rendering, then you should specify a custom accessor.
A coordinate accessor function which returns the x-coordinate value. The x accessor will be invoked for each defined element in the input data array, being passed the element d, the index i, and the array data as three arguments.
Returns the current y-coordinate accessor function, which defaults to a function returning second element of a two-element array of numbers.
Returns the current y-coordinate accessor function, which defaults to a function returning second element of a two-element array of numbers.
Sets the y accessor to the specified number and returns this line generator.
A constant y-coordinate value.
Sets the y accessor to the specified function and returns this line generator.
When a line is generated, the y accessor will be invoked for each defined element in the input data array.
The default y accessor assumes that the input data are two-element arrays of numbers. If your data are in a different format, or if you wish to transform the data before rendering, then you should specify a custom accessor.
A coordinate accessor function which returns the y-coordinate value. The y accessor will be invoked for each defined element in the input data array, being passed the element d, the index i, and the array data as three arguments.
The line generator produces a spline or polyline, as in a line chart. Lines also appear in many other visualization types, such as the links in hierarchical edge bundling.
The generic refers to the data type of an element in the input array passed into the line generator.