Interface AreaRadial<Datum>

A radial area generator.

A radial area generator is equivalent to the standard Cartesian area generator, except the x and y accessors are replaced with angle and radius accessors. Radial areas are always positioned relative to ⟨0,0⟩; use a transform (see: SVG, Canvas) to change the origin.

The generic refers to the data type of an element in the input array passed into the area generator.

interface AreaRadial {
    angle(): ((d, index, data) => number);
    angle(angle): AreaRadial<Datum>;
    angle(angle): AreaRadial<Datum>;
    context(): CanvasRenderingContext2D;
    context(context): AreaRadial<Datum>;
    curve(): CurveFactory;
    curve<C>(): C;
    curve(curve): AreaRadial<Datum>;
    defined(): ((d, index, data) => boolean);
    defined(defined): AreaRadial<Datum>;
    defined(defined): AreaRadial<Datum>;
    endAngle(): ((d, index, data) => number);
    endAngle(angle): AreaRadial<Datum>;
    endAngle(angle): AreaRadial<Datum>;
    innerRadius(): ((d, index, data) => number);
    innerRadius(radius): AreaRadial<Datum>;
    innerRadius(radius): AreaRadial<Datum>;
    lineEndAngle(): LineRadial<Datum>;
    lineInnerRadius(): LineRadial<Datum>;
    lineOuterRadius(): LineRadial<Datum>;
    lineStartAngle(): LineRadial<Datum>;
    outerRadius(): ((d, index, data) => number);
    outerRadius(radius): AreaRadial<Datum>;
    outerRadius(radius): AreaRadial<Datum>;
    radius(): ((d, index, data) => number);
    radius(radius): AreaRadial<Datum>;
    radius(radius): AreaRadial<Datum>;
    startAngle(): ((d, index, data) => number);
    startAngle(angle): AreaRadial<Datum>;
    startAngle(angle): AreaRadial<Datum>;
    (data): string;
    (data): void;
}

Type Parameters

  • Datum

  • Generates a radial area for the given array of data.

    IMPORTANT: If the rendering context of the radial area generator is null, then the radial area is returned as a path data string.

    Parameters

    • data: Datum[] | Iterable<Datum>

      Array of data elements.

    Returns string

  • Generates a radial area for the given array of data.

    IMPORTANT: If the radial area generator has been configured with a rendering context, then the radial area is rendered to this context as a sequence of path method calls and this function returns void.

    Parameters

    • data: Datum[] | Iterable<Datum>

      Array of data elements.

    Returns void

Methods

  • Returns the current startAngle accessor. The default startAngle accessor is a function returning the first element of a two-element array of numbers.

    Returns ((d, index, data) => number)

      • (d, index, data): number
      • Returns the current startAngle accessor. The default startAngle accessor is a function returning the first element of a two-element array of numbers.

        Parameters

        • d: Datum
        • index: number
        • data: Datum[]

        Returns number

  • Sets startAngle to a constant number angle and endAngle to null and returns this radial area generator.

    Setting endAngle to null indicates that the previously-computed startAngle value should be reused for the endAngle value.

    Parameters

    • angle: number

      A constant value in radians with 0 at -y (12 o’clock).

    Returns AreaRadial<Datum>

  • Sets startAngle to the specified function angle and endAngle to null and returns this radial area generator.

    The default startAngle 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.

    Parameters

    • angle: ((d, index, data) => number)

      An accessor function returning a value to be used for startAngle in radians with 0 at -y (12 o’clock). 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.

        • (d, index, data): number
        • Parameters

          • d: Datum
          • index: number
          • data: Datum[]

          Returns number

    Returns AreaRadial<Datum>

  • Returns the current curve factory, which defaults to curveLinear.

    Returns CurveFactory

  • Returns the current curve factory, which defaults to curveLinear.

    The generic allows to cast the curve factory to a specific type, if known.

    Type Parameters

    Returns C

  • Sets the curve factory and returns this radial area generator.

    Note that curveMonotoneX or curveMonotoneY are not recommended for radial areas because they assume that the data is monotonic in x or y, which is typically untrue of radial areas.

    Parameters

    Returns AreaRadial<Datum>

  • Returns the current defined accessor, which defaults to a function returning a constant boolean value of true.

    Returns ((d, index, data) => boolean)

      • (d, index, data): boolean
      • Returns the current defined accessor, which defaults to a function returning a constant boolean value of true.

        Parameters

        • d: Datum
        • index: number
        • data: Datum[]

        Returns boolean

  • Sets the defined accessor to the specified boolean and returns this radial area generator.

    The default accessor for defined returns a constant boolean value of true, thus assumes that the input data is always defined.

    When a radial 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 startAngle, endAngle, innerRadius and outerRadius 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.

    Parameters

    • defined: boolean

      A boolean constant.

    Returns AreaRadial<Datum>

  • Sets the defined accessor to the specified function and returns this radial area generator.

    The default accessor for defined returns a constant boolean value of true, thus assumes that the input data is always defined.

    When a radial 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 startAngle, endAngle, innerRadius and outerRadius 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.

    Parameters

    • defined: ((d, index, data) => boolean)

      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.

        • (d, index, data): boolean
        • Parameters

          • d: Datum
          • index: number
          • data: Datum[]

          Returns boolean

    Returns AreaRadial<Datum>

  • Returns the current endAngle accessor, which defaults to null, indicating that the previously-computed startAngle value should be reused for the endAngle value.

    Returns ((d, index, data) => number)

      • (d, index, data): number
      • Parameters

        • d: Datum
        • index: number
        • data: Datum[]

        Returns number

  • Equivalent to area.x1, except the accessor returns the angle in radians, with 0 at -y (12 o’clock). Note: typically angle is used instead of setting separate start and end angles.

    Parameters

    • angle: number

    Returns AreaRadial<Datum>

  • Sets endAngle to the specified function and returns this radial area generator.

    The default endAngle accessor is null, indicating that the previously-computed startAngle value should be reused for the endAngle 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.

    Parameters

    • angle: ((d, index, data) => number)

      An accessor function returning a value to be used for endAngle in radians with 0 at -y (12 o’clock). 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.

        • (d, index, data): number
        • Parameters

          • d: Datum
          • index: number
          • data: Datum[]

          Returns number

    Returns AreaRadial<Datum>

  • Returns the current innerRadius accessor. The default innerRadius accessor is a function a constant value of zero.

    Returns ((d, index, data) => number)

      • (d, index, data): number
      • Returns the current innerRadius accessor. The default innerRadius accessor is a function a constant value of zero.

        Parameters

        • d: Datum
        • index: number
        • data: Datum[]

        Returns number

  • Sets innerRadius to a constant number and returns this radial area generator.

    Parameters

    • radius: number

      A constant value.

    Returns AreaRadial<Datum>

  • Sets innerRadius to the specified function and returns this radial area generator.

    The default innerRadius 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.

    Parameters

    • radius: ((d, index, data) => number)

      An accessor function returning a value to be used for innerRadius. 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.

        • (d, index, data): number
        • Parameters

          • d: Datum
          • index: number
          • data: Datum[]

          Returns number

    Returns AreaRadial<Datum>

  • Returns a new radial line generator that has this radial area generator’s current defined accessor, curve and context. The line’s angle accessor is this area’s end angle accessor, and the line’s radius accessor is this area’s inner radius accessor.

    Returns LineRadial<Datum>

  • Returns a new radial line generator that has this radial area generator’s current defined accessor, curve and context. The line’s angle accessor is this area’s start angle accessor, and the line’s radius accessor is this area’s inner radius accessor.

    Returns LineRadial<Datum>

  • Returns a new radial line generator that has this radial area generator’s current defined accessor, curve and context. The line’s angle accessor is this area’s start angle accessor, and the line’s radius accessor is this area’s outer radius accessor.

    Returns LineRadial<Datum>

  • Returns a new radial line generator that has this radial area generator’s current defined accessor, curve and context. The line’s angle accessor is this area’s start angle accessor, and the line’s radius accessor is this area’s inner radius accessor.

    Returns LineRadial<Datum>

  • Returns the current outerRadius accessor or null. The default outerRadius accessor is a function returning the second element of a two-element array of numbers.

    If the outerRadius accessor is null, the previously-computed innerRadius value is reused for the outerRadius value.

    Returns ((d, index, data) => number)

      • (d, index, data): number
      • Parameters

        • d: Datum
        • index: number
        • data: Datum[]

        Returns number

  • Equivalent to area.y1, except the accessor returns the radius: the distance from the origin ⟨0,0⟩.

    Parameters

    • radius: number

    Returns AreaRadial<Datum>

  • Sets outerRadius to the specified function and returns this radial area generator.

    The default outerRadius 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.

    Parameters

    • radius: ((d, index, data) => number)

      An accessor function returning a value to be used for outerRadius. 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.

        • (d, index, data): number
        • Parameters

          • d: Datum
          • index: number
          • data: Datum[]

          Returns number

    Returns AreaRadial<Datum>

  • Returns the current innerRadius accessor. The default innerRadius accessor is a function returning a constant value of zero.

    Returns ((d, index, data) => number)

      • (d, index, data): number
      • Returns the current innerRadius accessor. The default innerRadius accessor is a function returning a constant value of zero.

        Parameters

        • d: Datum
        • index: number
        • data: Datum[]

        Returns number

  • Sets innerRadius to a constant number radius and outerRadius to null and returns this radial area generator.

    Setting outerRadius to null indicates that the previously-computed innerRadius value should be reused for the outerRadius value.

    Parameters

    • radius: number

      A constant value to be used for innerRadius.

    Returns AreaRadial<Datum>

  • Sets innerRadius to the accessor function radius and outerRadius to null and returns this radial area generator.

    The default innerRadius 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.

    Parameters

    • radius: ((d, index, data) => number)

      An accessor function returning a value to be used for innerRadius. 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.

        • (d, index, data): number
        • Parameters

          • d: Datum
          • index: number
          • data: Datum[]

          Returns number

    Returns AreaRadial<Datum>

  • Returns the current startAngle accessor. The default startAngle accessor is a function returning the first element of a two-element array of numbers.

    Returns ((d, index, data) => number)

      • (d, index, data): number
      • Returns the current startAngle accessor. The default startAngle accessor is a function returning the first element of a two-element array of numbers.

        Parameters

        • d: Datum
        • index: number
        • data: Datum[]

        Returns number

  • Sets startAngle to a constant number and returns this radial area generator.

    Parameters

    • angle: number

      A constant value in radians with 0 at -y (12 o’clock).

    Returns AreaRadial<Datum>

  • Sets startAngle to the specified function and returns this radial area generator.

    The default startAngle 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.

    Parameters

    • angle: ((d, index, data) => number)

      An accessor function returning a value to be used for startAngle in radians with 0 at -y (12 o’clock). 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.

        • (d, index, data): number
        • Parameters

          • d: Datum
          • index: number
          • data: Datum[]

          Returns number

    Returns AreaRadial<Datum>