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

A ribbon generator to suport rendering of chords in a chord diagram.

The first generic corresponds to the type of the "this" context within which the ribbon generator and its accessor functions will be invoked.

The second generic corresponds to the datum type representing a chord for which the ribbon is to be generated. The default type is Ribbon.

The third generic corresponds to the datum type of the chord subgroup, i.e. source or target of the cord. The default type is RibbonSubgroup.

Type parameters

  • This

  • RibbonDatum

  • RibbonSubgroupDatum

Hierarchy

  • RibbonGenerator

Callable

  • __call(this: This, d: RibbonDatum, ...args: any[]): void
  • __call(this: This, d: RibbonDatum, ...args: any[]): string | null
  • Generates a ribbon for the given arguments.

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

    The "this" context within which this function is invoked, will be the context within which the accessor methods of the generator are invoked. All arguments passed into this function, will be passed to the accessor functions of the generator.

    Parameters

    • this: This
    • d: RibbonDatum

      The datum representing the chord for which the ribbon is to be generated.

    • Rest ...args: any[]

    Returns void

  • Generates a ribbon for the given arguments.

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

    The "this" context within which this function is invoked, will be the context within which the accessor methods of the generator are invoked. All arguments passed into this function, will be passed to the accessor functions of the generator.

    Parameters

    • this: This
    • d: RibbonDatum

      The datum representing the chord for which the ribbon is to be generated.

    • Rest ...args: any[]

    Returns string | null

Index

Methods

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 ribbon generator.

    If the context is not null, then the generated ribbon 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 ribbon generator.

    A path data string representing the generated ribbon will be returned when the generator is invoked with data. See also d3-path.

    Parameters

    • context: null

      null, to remove rendering context.

endAngle

  • endAngle(): function
  • endAngle(angle: number)
  • endAngle(angle: function)
  • Returns the current end angle accessor, which defaults to a function returning the "endAngle" property (assumed to be a number in radians) of the source or target object returned by the source or target accessor, respectively.

    Returns function

      • (this: This, d: RibbonSubgroupDatum, ...args: any[]): number
      • Parameters

        • this: This
        • d: RibbonSubgroupDatum
        • Rest ...args: any[]

        Returns number

  • Sets the end angle to a fixed number in radians and returns this ribbon generator.

    Parameters

    • angle: number

      A fixed numeric value for the end angle in radians.

  • Sets the end angle accessor to the specified function and returns this ribbon generator.

    Parameters

    • angle: function

      An accessor function which is invoked for the source and target of the chord. The accessor function is invoked in the same "this" context as the generator was invoked in and receives as the first argument the source or target object returned by the respective source or target accessor function of the generator. It is also passed any additional arguments that were passed into the generator, with the exception of the first element representing the chord datum itself. The function returns the end angle in radians.

        • (this: This, d: RibbonSubgroupDatum, ...args: any[]): number
        • Parameters

          • this: This
          • d: RibbonSubgroupDatum
          • Rest ...args: any[]

          Returns number

radius

  • radius(): function
  • radius(radius: number)
  • radius(radius: function)
  • Returns the current radius accessor, which defaults to a function returning the "radius" property (assumed to be a number) of the source or target object returned by the source or target accessor, respectively.

    Returns function

      • (this: This, d: RibbonSubgroupDatum, ...args: any[]): number
      • Parameters

        • this: This
        • d: RibbonSubgroupDatum
        • Rest ...args: any[]

        Returns number

  • Sets the radius to a fixed number and returns this ribbon generator.

    Parameters

    • radius: number

      A fixed numeric value for the radius.

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

    Parameters

    • radius: function

      An accessor function which is invoked for the source and target of the chord. The accessor function is invoked in the same "this" context as the generator was invoked in and receives as the first argument the source or target object returned by the respective source or target accessor function of the generator. It is also passed any additional arguments that were passed into the generator, with the exception of the first element representing the chord datum itself. The function returns the radius value.

        • (this: This, d: RibbonSubgroupDatum, ...args: any[]): number
        • Parameters

          • this: This
          • d: RibbonSubgroupDatum
          • Rest ...args: any[]

          Returns number

source

  • source(): function
  • source(source: function)
  • Returns the current source accessor, which defaults to a function returning the "source" property of the first argument passed into the accessor.

    Returns function

      • (this: This, d: RibbonDatum, ...args: any[]): RibbonSubgroupDatum
      • Parameters

        • this: This
        • d: RibbonDatum
        • Rest ...args: any[]

        Returns RibbonSubgroupDatum

  • Sets the source accessor to the specified function and returns this ribbon generator.

    Parameters

    • source: function

      An accessor function returning the source datum of the chord. The accessor function is invoked in the same "this" context as the generator was invoked in and receives the same arguments that were passed into the ribbon generator.

        • (this: This, d: RibbonDatum, ...args: any[]): RibbonSubgroupDatum
        • Parameters

          • this: This
          • d: RibbonDatum
          • Rest ...args: any[]

          Returns RibbonSubgroupDatum

startAngle

  • startAngle(): function
  • startAngle(angle: number)
  • startAngle(angle: function)
  • Returns the current start angle accessor, which defaults to a function returning the "startAngle" property (assumed to be a number in radians) of the source or target object returned by the source or target accessor, respectively.

    Returns function

      • (this: This, d: RibbonSubgroupDatum, ...args: any[]): number
      • Parameters

        • this: This
        • d: RibbonSubgroupDatum
        • Rest ...args: any[]

        Returns number

  • Sets the start angle to a fixed number in radians and returns this ribbon generator.

    Parameters

    • angle: number

      A fixed numeric value for the start angle in radians.

  • Sets the start angle accessor to the specified function and returns this ribbon generator.

    Parameters

    • angle: function

      An accessor function which is invoked for the source and target of the chord. The accessor function is invoked in the same "this" context as the generator was invoked in and receives as the first argument the source or target object returned by the respective source or target accessor function of the generator. It is also passed any additional arguments that were passed into the generator, with the exception of the first element representing the chord datum itself. The function returns the start angle in radians.

        • (this: This, d: RibbonSubgroupDatum, ...args: any[]): number
        • Parameters

          • this: This
          • d: RibbonSubgroupDatum
          • Rest ...args: any[]

          Returns number

target

  • target(): function
  • target(target: function)
  • Returns the current target accessor, which defaults to a function returning the "target" property of the first argument passed into the accessor.

    Returns function

      • (this: This, d: RibbonDatum, ...args: any[]): RibbonSubgroupDatum
      • Parameters

        • this: This
        • d: RibbonDatum
        • Rest ...args: any[]

        Returns RibbonSubgroupDatum

  • Sets the target accessor to the specified function and returns this ribbon generator.

    Parameters

    • target: function

      An accessor function returning the target datum of the chord. The accessor function is invoked in the same "this" context as the generator was invoked in and receives the same arguments that were passed into the ribbon generator.

        • (this: This, d: RibbonDatum, ...args: any[]): RibbonSubgroupDatum
        • Parameters

          • this: This
          • d: RibbonDatum
          • Rest ...args: any[]

          Returns RibbonSubgroupDatum

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