WebCola
Options
All
  • Public
  • Public/Protected
  • All
Menu

The radial line generator produces a spline or polyline, as in a line chart.

A radial line generator is equivalent to the standard Cartesian line generator, except the x and y accessors are replaced with angle and radius accessors. Radial lines 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 line generator.

Type parameters

  • Datum

Hierarchy

  • RadialLine

Callable

  • __call(data: Datum[]): string | null
  • __call(data: Datum[]): void
  • Generates a radial line for the given array of data. Depending on this radial 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 radial line generator is null, then the radial line is returned as a path data string.

    Parameters

    • data: Datum[]

      Array of data elements.

    Returns string | null

  • Generates a radial line for the given array of data. Depending on this radial line generator’s associated curve, the given input data may need to be sorted by x-value before being passed to the radial line generator.

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

    Parameters

    • data: Datum[]

      Array of data elements.

    Returns void

Index

Methods

angle

  • angle(): function
  • angle(angle: number)
  • angle(angle: function)
  • Returns the current angle accessor function, which defaults to a function returning first element of a two-element array of numbers.

    Returns function

      • (d: Datum, index: number, data: Datum[]): number
      • Parameters

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

        Returns number

  • Sets the angle accessor to the specified number and returns this radial line generator.

    Parameters

    • angle: number

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

  • Sets the angle accessor to the specified function and returns this radial line generator.

    When a radial line is generated, the angle accessor will be invoked for each defined element in the input data array.

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

    Parameters

    • angle: function

      An angle accessor function which returns the angle value in radians, with 0 at -y (12 o’clock). The angle 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: Datum, index: number, data: Datum[]): number
        • Parameters

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

          Returns number

context

  • context(): CanvasRenderingContext2D | null
  • context(context: CanvasRenderingContext2D)
  • context(context: null)
  • Returns the current rendering context, which defaults to null.

    Returns CanvasRenderingContext2D | null

  • Sets the rendering context and returns this radial line generator.

    If the context is not null, then the generated radial line is rendered to this context as a sequence of path method calls.

    Parameters

    • context: CanvasRenderingContext2D

      The rendering context.

  • Sets the rendering context to null and returns this radial line generator.

    A path data string representing the generated radial line will be returned when the generator is invoked with data.

    Parameters

    • context: null

      null, to remove rendering context.

curve

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

    Returns CurveFactory | CurveFactoryLineOnly

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

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

    Type parameters

    Returns C

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

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

    Parameters

defined

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

    Returns function

      • (d: Datum, index: number, data: Datum[]): boolean
      • Parameters

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

        Returns boolean

  • Sets the defined accessor to the specified boolean and returns this radial 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 radial 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 angle and radius accessors will subsequently be evaluated and the point will be added to the current radial line segment. Otherwise, the element will be skipped, the current radial line segment will be ended, and a new radial line segment will be generated for the next defined point. As a result, the generated radial line may have several discrete segments.

    Note that if a radial 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.

    Parameters

    • defined: boolean

      A boolean constant

  • Sets the defined accessor to the specified function and returns this radial 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 radial 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 angle and radius accessors will subsequently be evaluated and the point will be added to the current radial line segment. Otherwise, the element will be skipped, the current radial line segment will be ended, and a new radial line segment will be generated for the next defined point. As a result, the generated radial line may have several discrete segments.

    Note that if a radial 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.

    Parameters

    • defined: function

      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: Datum, index: number, data: Datum[]): boolean
        • Parameters

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

          Returns boolean

radius

  • radius(): function
  • radius(radius: number)
  • radius(radius: function)
  • Returns the current radius accessor function, which defaults to a function returning second element of a two-element array of numbers.

    Returns function

      • (d: Datum, index: number, data: Datum[]): number
      • Parameters

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

        Returns number

  • Sets the radius accessor to the specified number and returns this radial line generator.

    Parameters

    • radius: number

      A constant radius value.

  • Sets the radius accessor to the specified function and returns this radial line generator.

    When a radial line is generated, the radius accessor will be invoked for each defined element in the input data array.

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

    Parameters

    • radius: function

      A radius accessor function which returns the radius value. The radius 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: Datum, index: number, data: Datum[]): number
        • Parameters

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

          Returns number

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc