Interface RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>

A ribbon generator to support 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.

interface RibbonGenerator {
    context(): CanvasRenderingContext2D;
    context(context): RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>;
    endAngle(): ((this, d, ...args) => number);
    endAngle(angle): RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>;
    endAngle(angle): RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>;
    padAngle(): ((this, d, ...args) => number);
    padAngle(angle): RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>;
    padAngle(angle): RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>;
    radius(): ((this, d, ...args) => number);
    radius(radius): RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>;
    radius(radius): RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>;
    source(): ((this, d, ...args) => RibbonSubgroupDatum);
    source(source): RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>;
    sourceRadius(): ((this, d, ...args) => number);
    sourceRadius(radius): RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>;
    sourceRadius(radius): RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>;
    startAngle(): ((this, d, ...args) => number);
    startAngle(angle): RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>;
    startAngle(angle): RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>;
    target(): ((this, d, ...args) => RibbonSubgroupDatum);
    target(target): RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>;
    targetRadius(): ((this, d, ...args) => number);
    targetRadius(radius): RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>;
    targetRadius(radius): RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>;
    (this, d, ...args): void;
    (this, d, ...args): string;
}

Type Parameters

  • This

  • RibbonDatum

  • RibbonSubgroupDatum

Hierarchy

  • 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

Methods

  • Returns the current rendering context, which defaults to null.

    Returns CanvasRenderingContext2D

  • Sets the 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. Otherwise, a path data string representing the generated ribbon is returned. See also d3-path.

    Parameters

    Returns RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>

  • 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 ((this, d, ...args) => number)

      • (this, d, ...args): number
      • 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.

        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.

    Returns RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>

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

    Parameters

    • angle: ((this, d, ...args) => number)

      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, d, ...args): number
        • Parameters

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

          Returns number

    Returns RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>

  • Returns the current pad angle accessor, which defaults to a function returning 0.

    Returns ((this, d, ...args) => number)

      • (this, d, ...args): number
      • Returns the current pad angle accessor, which defaults to a function returning 0.

        Parameters

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

        Returns number

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

    Parameters

    • angle: number

      A fixed numeric value for the pad angle in radians.

    Returns RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>

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

    Parameters

    • angle: ((this, d, ...args) => number)

      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 pad angle in radians.

        • (this, d, ...args): number
        • Parameters

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

          Returns number

    Returns RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>

  • 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 ((this, d, ...args) => number)

      • (this, d, ...args): number
      • 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.

        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.

    Returns RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>

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

    Parameters

    • radius: ((this, d, ...args) => number)

      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, d, ...args): number
        • Parameters

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

          Returns number

    Returns RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>

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

    Returns ((this, d, ...args) => RibbonSubgroupDatum)

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

        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: ((this, d, ...args) => RibbonSubgroupDatum)

      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, d, ...args): RibbonSubgroupDatum
        • Parameters

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

          Returns RibbonSubgroupDatum

    Returns RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>

  • Returns the current source 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 ((this, d, ...args) => number)

      • (this, d, ...args): number
      • Returns the current source 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.

        Parameters

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

        Returns number

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

    Parameters

    • radius: number

      A fixed numeric value for the source radius.

    Returns RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>

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

    Parameters

    • radius: ((this, d, ...args) => number)

      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 source radius value.

        • (this, d, ...args): number
        • Parameters

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

          Returns number

    Returns RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>

  • 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 ((this, d, ...args) => number)

      • (this, d, ...args): number
      • 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.

        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.

    Returns RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>

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

    Parameters

    • angle: ((this, d, ...args) => number)

      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, d, ...args): number
        • Parameters

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

          Returns number

    Returns RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>

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

    Returns ((this, d, ...args) => RibbonSubgroupDatum)

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

        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: ((this, d, ...args) => RibbonSubgroupDatum)

      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, d, ...args): RibbonSubgroupDatum
        • Parameters

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

          Returns RibbonSubgroupDatum

    Returns RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>

  • Returns the current target 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 ((this, d, ...args) => number)

      • (this, d, ...args): number
      • Returns the current target 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.

        Parameters

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

        Returns number

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

    Parameters

    • radius: number

      A fixed numeric value for the target radius.

    Returns RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>

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

    Parameters

    • radius: ((this, d, ...args) => number)

      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 target radius value.

        • (this, d, ...args): number
        • Parameters

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

          Returns number

    Returns RibbonGenerator<This, RibbonDatum, RibbonSubgroupDatum>