Generates an area for the given array of data. Depending on this area generator’s associated curve, the given input data may need to be sorted by x-value before being passed to the area generator.
IMPORTANT: If the rendering context of the area generator is null, then the area is returned as a path data string.
Array of data elements.
Generates an area for the given array of data. Depending on this area generator’s associated curve, the given input data may need to be sorted by x-value before being passed to the area generator.
IMPORTANT: If the area generator has been configured with a rendering context, then the area 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 area 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 area 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 area generator.
The default accessor for defined returns a constant boolean value of true, thus assumes that the input data is always defined. When an area 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 x0, x1, y0 and y1 accessors will subsequently be evaluated and the point will be added to the current area segment. Otherwise, the element will be skipped, the current area segment will be ended, and a new area segment will be generated for the next defined point. As a result, the generated area may have several discrete segments.
Note that if an area 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 area generator.
The default accessor for defined returns a constant boolean value of true, thus assumes that the input data is always defined.
The default accessor for defined returns a constant boolean value of true, thus assumes that the input data is always defined. When an area 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 x0, x1, y0 and y1 accessors will subsequently be evaluated and the point will be added to the current area segment. Otherwise, the element will be skipped, the current area segment will be ended, and a new area segment will be generated for the next defined point. As a result, the generated area may have several discrete segments.
Note that if an area 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 x0 accessor. The default x0 accessor is a function returning the first element of a two-element array of numbers.
Returns the current x0 accessor. The default x0 accessor is a function returning the first element of a two-element array of numbers.
Sets x0 to a constant number x and x1 to null and returns this area generator.
Setting x1 to null indicates that the previously-computed x0 value should be reused for the x1 value.
A constant value to be used for x0.
Sets x0 to the specified function x and x1 to null and returns this area generator.
The default x0 accessor assumes that the input data are two-element arrays of numbers and returns the first element. 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.
An accessor function returning a value to be used for x0. 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 x0 accessor. The default x0 accessor is a function returning the first element of a two-element array of numbers.
Returns the current x0 accessor. The default x0 accessor is a function returning the first element of a two-element array of numbers.
Sets x0 to a constant number and returns this area generator.
A constant value.
Sets x0 to the specified function and returns this area generator.
The default x0 accessor assumes that the input data are two-element arrays of numbers and returns the first element. 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.
An accessor function returning a value to be used for x0. 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 x1 accessor, which defaults to null, indicating that the previously-computed x0 value should be reused for the x1 value.
Sets the x1 accessor to the specified number and returns this area generator.
Sets x1 to the specified function and returns this area generator.
The default x1 accessor is null, indicating that the previously-computed x0 value should be reused for the x1 value. 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.
An accessor function returning a value to be used for x1. 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 y0 accessor. The default y0 accessor is a function returning a constant value of zero.
Returns the current y0 accessor. The default y0 accessor is a function returning a constant value of zero.
Sets y0 to a constant number y and y1 to null and returns this area generator.
Setting y1 to null indicates that the previously-computed y0 value should be reused for the y1 value.
A constant value to be used for y0.
Sets y0 to the accessor function y and y1 to null and returns this area generator.
The default y0 accessor returns a constant value of zero. 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.
An accessor function returning a value to be used for y0. 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 y0 accessor. The default y0 accessor is a function a constant value of zero.
Returns the current y0 accessor. The default y0 accessor is a function a constant value of zero.
Sets y0 to a constant number and returns this area generator.
A constant value.
Sets y0 to the specified function and returns this area generator.
The default y0 accessor is a function which returns a constant value of zero. 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.
An accessor function returning a value to be used for y0. 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 y1 accessor or null. The default y1 accessor is a function returning the second element of a two-element array of numbers.
If the y1 accessor is null, the previously-computed y0 value is reused for the y1 value.
sets the y1 accessor to the specified number and returns this area generator.
Sets y1 to the specified function and returns this area generator.
The default y1 accessor assumes that the input data are two-element arrays of numbers and returns the second element. 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.
An accessor function returning a value to be used for y1. 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.
The area generator produces an area, as in an area chart. An area is defined by two bounding lines, either splines or polylines. Typically, the two lines share the same x-values (x0 = x1), differing only in y-value (y0 and y1); most commonly, y0 is defined as a constant representing zero. The first line (the topline) is defined by x1 and y1 and is rendered first; the second line (the baseline) is defined by x0 and y0 and is rendered second, with the points in reverse order. With a curveLinear curve, this produces a clockwise polygon.
The generic refers to the data type of an element in the input array passed into the area generator.