Interface PackLayout<Datum>

interface PackLayout {
    padding(): ((node) => number);
    padding(padding): PackLayout<Datum>;
    padding(padding): PackLayout<Datum>;
    radius(): ((node) => number);
    radius(radius): PackLayout<Datum>;
    size(): [number, number];
    size(size): PackLayout<Datum>;
    (root): HierarchyCircularNode<Datum>;
}

Type Parameters

  • Datum

  • Lays out the specified root hierarchy. You must call root.sum before passing the hierarchy to the pack layout. You probably also want to call root.sort to order the hierarchy before computing the layout.

    Parameters

    Returns HierarchyCircularNode<Datum>

Methods

  • Returns the current padding accessor, which defaults to the constant zero.

    Returns ((node) => number)

      • (node): number
      • Returns the current padding accessor, which defaults to the constant zero.

        Parameters

        Returns number

  • Sets this pack layout’s padding accessor to the specified number and returns this pack layout. Returns the current padding accessor, which defaults to the constant zero.

    When siblings are packed, tangent siblings will be separated by approximately the specified padding; the enclosing parent circle will also be separated from its children by approximately the specified padding. If an explicit radius is not specified, the padding is approximate because a two-pass algorithm is needed to fit within the layout size: the circles are first packed without padding; a scaling factor is computed and applied to the specified padding; and lastly the circles are re-packed with padding.

    Parameters

    • padding: number

      The specified padding value.

    Returns PackLayout<Datum>

  • Sets this pack layout’s padding accessor to the specified function and returns this pack layout. Returns the current padding accessor, which defaults to the constant zero.

    When siblings are packed, tangent siblings will be separated by approximately the specified padding; the enclosing parent circle will also be separated from its children by approximately the specified padding. If an explicit radius is not specified, the padding is approximate because a two-pass algorithm is needed to fit within the layout size: the circles are first packed without padding; a scaling factor is computed and applied to the specified padding; and lastly the circles are re-packed with padding.

    Parameters

    • padding: ((node) => number)

      The specified padding function.

    Returns PackLayout<Datum>

  • Returns the current radius accessor, which defaults to null.

    Returns ((node) => number)

  • Sets the pack layout’s radius accessor to the specified function and returns this pack layout. If the radius accessor is null, the radius of each leaf circle is derived from the leaf node.value (computed by node.sum); the radii are then scaled proportionally to fit the layout size. If the radius accessor is not null, the radius of each leaf circle is specified exactly by the function.

    Parameters

    • radius: ((node) => number)

      The specified radius accessor.

    Returns PackLayout<Datum>

  • Returns the current size, which defaults to [1, 1].

    Returns [number, number]

  • Sets this pack layout’s size to the specified [width, height] array and returns this pack layout.

    Parameters

    • size: [number, number]

      The specified two-element size array.

    Returns PackLayout<Datum>