Interface ClusterLayout<Datum>

interface ClusterLayout {
    nodeSize(): [number, number];
    nodeSize(size): ClusterLayout<Datum>;
    separation(): ((a, b) => number);
    separation(separation): ClusterLayout<Datum>;
    size(): [number, number];
    size(size): ClusterLayout<Datum>;
    (root): HierarchyPointNode<Datum>;
}

Type Parameters

  • Datum

  • Lays out the specified root hierarchy. You may want to call root.sort before passing the hierarchy to the cluster layout.

    Parameters

    Returns HierarchyPointNode<Datum>

Methods

  • Returns the current node size, which defaults to null. A node size of null indicates that a layout size will be used instead.

    Returns [number, number]

  • Sets this cluster layout’s node size to the specified [width, height] array and returns this cluster layout. When a node size is specified, the root node is always positioned at <0, 0>.

    Parameters

    • size: [number, number]

      The specified two-element size array.

    Returns ClusterLayout<Datum>

  • Returns the current separation accessor, which defaults to: (a, b) => a.parent == b.parent ? 1 : 2.

    Returns ((a, b) => number)

      • (a, b): number
      • Returns the current separation accessor, which defaults to: (a, b) => a.parent == b.parent ? 1 : 2.

        Parameters

        Returns number

  • Sets the separation accessor to the specified function and returns this cluster layout. The separation accessor is used to separate neighboring leaves.

    Parameters

    • separation: ((a, b) => number)

      The separation function is passed two leaves a and b, and must return the desired separation. The nodes are typically siblings, though the nodes may be more distantly related if the layout decides to place such nodes adjacent.

    Returns ClusterLayout<Datum>

  • Returns the current layout size, which defaults to [1, 1]. A layout size of null indicates that a node size will be used instead.

    Returns [number, number]

  • Sets this cluster layout’s size to the specified [width, height] array and returns the cluster layout. The size represent an arbitrary coordinate system; for example, to produce a radial layout, a size of [360, radius] corresponds to a breadth of 360° and a depth of radius.

    Parameters

    • size: [number, number]

      The specified two-element size array.

    Returns ClusterLayout<Datum>