@types/d3-hierarchy

  • Version 3.0.2
  • Published
  • 38.7 kB
  • No dependencies
  • MIT license

Install

npm i @types/d3-hierarchy
yarn add @types/d3-hierarchy
pnpm add @types/d3-hierarchy

Overview

TypeScript definitions for D3JS d3-hierarchy module

Index

Variables

variable treemapResquarify

const treemapResquarify: RatioSquarifyTilingFactory;
  • Like d3.treemapSquarify, except preserves the topology (node adjacencies) of the previous layout computed by d3.treemapResquarify, if there is one and it used the same target aspect ratio. This tiling method is good for animating changes to treemaps because it only changes node sizes and not their relative positions, thus avoiding distracting shuffling and occlusion. The downside of a stable update, however, is a suboptimal layout for subsequent updates: only the first layout uses the Bruls et al. squarified algorithm.

variable treemapSquarify

const treemapSquarify: RatioSquarifyTilingFactory;
  • Implements the squarified treemap algorithm by Bruls et al., which seeks to produce rectangles of a given aspect ratio.

Functions

function cluster

cluster: <Datum>() => ClusterLayout<Datum>;
  • Creates a new cluster layout with default settings.

function hierarchy

hierarchy: <Datum>(
data: Datum,
children?: (d: Datum) => Iterable<Datum> | null | undefined
) => HierarchyNode<Datum>;
  • Constructs a root node from the specified hierarchical data.

    Parameter data

    The root specified data. If *data* is a Map, it is implicitly converted to the entry [undefined, *data*], and the children accessor instead defaults to (d) => Array.isArray(d) ? d[1] : null;.

    Parameter children

    The specified children accessor function is invoked for each datum, starting with the root data, and must return an iterable of data representing the children, if any. If children is not specified, it defaults to: (d) => d.children.

function pack

pack: <Datum>() => PackLayout<Datum>;
  • Creates a new pack layout with the default settings.

function packEnclose

packEnclose: <Datum extends PackCircle>(circles: Datum[]) => PackCircle;
  • Computes the smallest circle that encloses the specified array of circles, each of which must have a circle.r property specifying the circle’s radius, and circle.x and circle.y properties specifying the circle’s center. The enclosing circle is computed using the Matoušek-Sharir-Welzl algorithm. (See also Apollonius’ Problem.)

    Parameter circles

    The specified array of circles to pack.

function packSiblings

packSiblings: <Datum extends PackRadius>(
circles: Datum[]
) => Array<Datum & PackCircle>;
  • Packs the specified array of circles, each of which must have a circle.r property specifying the circle’s radius. The circles are positioned according to the front-chain packing algorithm by Wang et al.

    Parameter circles

    The specified array of circles to pack.

function partition

partition: <Datum>() => PartitionLayout<Datum>;
  • Creates a new partition layout with the default settings.

function stratify

stratify: <Datum>() => StratifyOperator<Datum>;
  • Constructs a new stratify operator with the default settings.

function tree

tree: <Datum>() => TreeLayout<Datum>;
  • Creates a new tree layout with default settings.

function treemap

treemap: <Datum>() => TreemapLayout<Datum>;
  • Creates a new treemap layout with default settings.

function treemapBinary

treemapBinary: (
node: HierarchyRectangularNode<any>,
x0: number,
y0: number,
x1: number,
y1: number
) => void;
  • Recursively partitions the specified nodes into an approximately-balanced binary tree, choosing horizontal partitioning for wide rectangles and vertical partitioning for tall rectangles.

function treemapDice

treemapDice: (
node: HierarchyRectangularNode<any>,
x0: number,
y0: number,
x1: number,
y1: number
) => void;
  • Divides the rectangular area specified by x0, y0, x1, y1 horizontally according the value of each of the specified node’s children. The children are positioned in order, starting with the left edge (x0) of the given rectangle. If the sum of the children’s values is less than the specified node’s value (i.e., if the specified node has a non-zero internal value), the remaining empty space will be positioned on the right edge (x1) of the given rectangle.

function treemapSlice

treemapSlice: (
node: HierarchyRectangularNode<any>,
x0: number,
y0: number,
x1: number,
y1: number
) => void;
  • Divides the rectangular area specified by x0, y0, x1, y1 vertically according the value of each of the specified node’s children. The children are positioned in order, starting with the top edge (y0) of the given rectangle. If the sum of the children’s values is less than the specified node’s value (i.e., if the specified node has a non-zero internal value), the remaining empty space will be positioned on the bottom edge (y1) of the given rectangle.

function treemapSliceDice

treemapSliceDice: (
node: HierarchyRectangularNode<any>,
x0: number,
y0: number,
x1: number,
y1: number
) => void;
  • If the specified node has odd depth, delegates to treemapSlice; otherwise delegates to treemapDice.

Interfaces

interface ClusterLayout

interface ClusterLayout<Datum> {}

    method nodeSize

    nodeSize: { (): [number, number] | null; (size: [number, number]): this };
    • Returns the current node size, which defaults to null. A node size of null indicates that a layout size will be used instead.

    • 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>.

      Parameter size

      The specified two-element size array.

    method separation

    separation: {
    (): (a: HierarchyPointNode<Datum>, b: HierarchyPointNode<Datum>) => number;
    (
    separation: (
    a: HierarchyPointNode<Datum>,
    b: HierarchyPointNode<Datum>
    ) => number
    ): this;
    };
    • Returns the current separation accessor, which defaults to: (a, b) => a.parent == b.parent ? 1 : 2.

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

      Parameter separation

      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.

    method size

    size: { (): [number, number] | null; (size: [number, number]): this };
    • Returns the current layout size, which defaults to [1, 1]. A layout size of null indicates that a node size will be used instead.

    • 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.

      Parameter size

      The specified two-element size array.

    call signature

    (root: HierarchyNode<Datum>): HierarchyPointNode<Datum>;
    • Lays out the specified root hierarchy. You may want to call root.sort before passing the hierarchy to the cluster layout.

      Parameter root

      The specified root hierarchy.

    interface HierarchyCircularLink<Datum> {}

      property source

      source: HierarchyCircularNode<Datum>;
      • The source of the link.

      property target

      target: HierarchyCircularNode<Datum>;
      • The target of the link.

      interface HierarchyCircularNode

      interface HierarchyCircularNode<Datum> extends HierarchyNode<Datum> {}

        property r

        r: number;
        • The radius of the circle.

        property x

        x: number;
        • The x-coordinate of the circle’s center.

        property y

        y: number;
        • The y-coordinate of the circle’s center.

        links: () => Array<HierarchyCircularLink<Datum>>;
        • Returns an array of links for this node, where each link is an object that defines source and target properties. The source of each link is the parent node, and the target is a child node.

        interface HierarchyLink<Datum> {}

          property source

          source: HierarchyNode<Datum>;
          • The source of the link.

          property target

          target: HierarchyNode<Datum>;
          • The target of the link.

          interface HierarchyNode

          interface HierarchyNode<Datum> {}

            property children

            children?: this[] | undefined;
            • An array of child nodes, if any; undefined for leaf nodes.

            property data

            data: Datum;
            • The associated data, as specified to the constructor.

            property depth

            readonly depth: number;
            • Zero for the root node, and increasing by one for each descendant generation.

            property height

            readonly height: number;
            • Zero for leaf nodes, and the greatest distance from any descendant leaf for internal nodes.

            property id

            readonly id?: string | undefined;
            • Optional node id string set by StratifyOperator, if hierarchical data was created from tabular data using stratify().

            property parent

            parent: this | null;
            • The parent node, or null for the root node.

            property value

            readonly value?: number | undefined;
            • Aggregated numeric value as calculated by sum(value) or count(), if previously invoked.

            method [Symbol.iterator]

            [Symbol.iterator]: () => Iterator<this>;
            • Returns an iterator over the node’s descendants in breadth-first order.

            method ancestors

            ancestors: () => this[];
            • Returns the array of ancestors nodes, starting with this node, then followed by each parent up to the root.

            method copy

            copy: () => this;
            • Return a deep copy of the subtree starting at this node. The returned deep copy shares the same data, however. The returned node is the root of a new tree; the returned node’s parent is always null and its depth is always zero.

            method count

            count: () => this;
            • Computes the number of leaves under this node and assigns it to node.value, and similarly for every descendant of node. If this node is a leaf, its count is one. Returns this node.

            method descendants

            descendants: () => this[];
            • Returns the array of descendant nodes, starting with this node, then followed by each child in topological order.

            method each

            each: <T = undefined>(
            func: (this: T, node: this, index: number, thisNode: this) => void,
            that?: T
            ) => this;
            • Invokes the specified function for node and each descendant in breadth-first order, such that a given node is only visited if all nodes of lesser depth have already been visited, as well as all preceding nodes of the same depth.

              Parameter func

              The specified function is passed the current descendant, the zero-based traversal index, and this node.

              Parameter that

              If that is specified, it is the this context of the callback.

            method eachAfter

            eachAfter: <T = undefined>(
            func: (this: T, node: this, index: number, thisNode: this) => void,
            that?: T
            ) => this;
            • Invokes the specified function for node and each descendant in post-order traversal, such that a given node is only visited after all of its descendants have already been visited.

              Parameter func

              The specified function is passed the current descendant, the zero-based traversal index, and this node.

              Parameter that

              If that is specified, it is the this context of the callback.

            method eachBefore

            eachBefore: <T = undefined>(
            func: (this: T, node: this, index: number, thisNode: this) => void,
            that?: T
            ) => this;
            • Invokes the specified function for node and each descendant in pre-order traversal, such that a given node is only visited after all of its ancestors have already been visited.

              Parameter func

              The specified function is passed the current descendant, the zero-based traversal index, and this node.

              Parameter that

              If that is specified, it is the this context of the callback.

            method find

            find: (filter: (node: this) => boolean) => this | undefined;
            • Returns the first node in the hierarchy from this node for which the specified filter returns a truthy value. undefined if no such node is found.

              Parameter filter

              Filter.

            method leaves

            leaves: () => this[];
            • Returns the array of leaf nodes in traversal order; leaves are nodes with no children.

            links: () => Array<HierarchyLink<Datum>>;
            • Returns an array of links for this node, where each link is an object that defines source and target properties. The source of each link is the parent node, and the target is a child node.

            method path

            path: (target: this) => this[];
            • Returns the shortest path through the hierarchy from this node to the specified target node. The path starts at this node, ascends to the least common ancestor of this node and the target node, and then descends to the target node.

              Parameter target

              The target node.

            method sort

            sort: (compare: (a: this, b: this) => number) => this;
            • Sorts the children of this node, if any, and each of this node’s descendants’ children, in pre-order traversal using the specified compare function, and returns this node.

              Parameter compare

              The compare function is passed two nodes a and b to compare. If a should be before b, the function must return a value less than zero; if b should be before a, the function must return a value greater than zero; otherwise, the relative order of a and b are not specified. See array.sort for more.

            method sum

            sum: (value: (d: Datum) => number) => this;
            • Evaluates the specified value function for this node and each descendant in post-order traversal, and returns this node. The node.value property of each node is set to the numeric value returned by the specified function plus the combined value of all descendants.

              Parameter value

              The value function is passed the node’s data, and must return a non-negative number.

            interface HierarchyPointLink<Datum> {}

              property source

              source: HierarchyPointNode<Datum>;
              • The source of the link.

              property target

              target: HierarchyPointNode<Datum>;
              • The target of the link.

              interface HierarchyPointNode

              interface HierarchyPointNode<Datum> extends HierarchyNode<Datum> {}

                property x

                x: number;
                • The x-coordinate of the node.

                property y

                y: number;
                • The y-coordinate of the node.

                links: () => Array<HierarchyPointLink<Datum>>;
                • Returns an array of links for this node, where each link is an object that defines source and target properties. The source of each link is the parent node, and the target is a child node.

                interface HierarchyRectangularLink<Datum> {}

                  property source

                  source: HierarchyRectangularNode<Datum>;
                  • The source of the link.

                  property target

                  target: HierarchyRectangularNode<Datum>;
                  • The target of the link.

                  interface HierarchyRectangularNode

                  interface HierarchyRectangularNode<Datum> extends HierarchyNode<Datum> {}

                    property x0

                    x0: number;
                    • The left edge of the rectangle.

                    property x1

                    x1: number;
                    • The right edge of the rectangle.

                    property y0

                    y0: number;
                    • The top edge of the rectangle

                    property y1

                    y1: number;
                    • The bottom edge of the rectangle.

                    links: () => Array<HierarchyRectangularLink<Datum>>;
                    • Returns an array of links for this node, where each link is an object that defines source and target properties. The source of each link is the parent node, and the target is a child node.

                    interface PackCircle

                    interface PackCircle {}

                      property r

                      r: number;
                      • The radius of the circle.

                      property x

                      x: number;
                      • The x-coordinate of the circle’s center.

                      property y

                      y: number;
                      • The y-coordinate of the circle’s center.

                      interface PackLayout

                      interface PackLayout<Datum> {}

                        method padding

                        padding: {
                        (): (node: HierarchyCircularNode<Datum>) => number;
                        (padding: number): this;
                        (padding: (node: HierarchyCircularNode<Datum>) => number): this;
                        };
                        • Returns the current padding accessor, which defaults to the constant zero.

                        • 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.

                          Parameter padding

                          The specified padding value.

                        • 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.

                          Parameter padding

                          The specified padding function.

                        method radius

                        radius: {
                        (): (node: HierarchyCircularNode<Datum>) => number;
                        (radius: (node: HierarchyCircularNode<Datum>) => number): this;
                        };
                        • Returns the current radius accessor, which defaults to null.

                        • 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.

                          Parameter radius

                          The specified radius accessor.

                        method size

                        size: { (): [number, number]; (size: [number, number]): this };
                        • Returns the current size, which defaults to [1, 1].

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

                          Parameter size

                          The specified two-element size array.

                        call signature

                        (root: HierarchyNode<Datum>): HierarchyCircularNode<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.

                          Parameter root

                          The specified root hierarchy.

                        interface PackRadius

                        interface PackRadius {}

                          property r

                          r: number;
                          • The radius of the circle.

                          property x

                          x?: number | undefined;
                          • The x-coordinate of the circle’s center.

                          property y

                          y?: number | undefined;
                          • The y-coordinate of the circle’s center.

                          interface PartitionLayout

                          interface PartitionLayout<Datum> {}

                            method padding

                            padding: { (): number; (padding: number): this };
                            • Returns the current padding, which defaults to zero.

                            • Sets the padding to the specified number and returns this partition layout. The padding is used to separate a node’s adjacent children.

                              Parameter padding

                              The specified padding value.

                            method round

                            round: { (): boolean; (round: boolean): this };
                            • Returns the current rounding state, which defaults to false.

                            • Enables or disables rounding according to the given boolean and returns this partition layout.

                              Parameter round

                              The specified boolean flag.

                            method size

                            size: { (): [number, number]; (size: [number, number]): this };
                            • Returns the current size, which defaults to [1, 1].

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

                              Parameter size

                              The specified two-element size array.

                            call signature

                            (root: HierarchyNode<Datum>): HierarchyRectangularNode<Datum>;
                            • Lays out the specified root hierarchy. You must call root.sum before passing the hierarchy to the partition layout. You probably also want to call root.sort to order the hierarchy before computing the layout.

                              Parameter root

                              The specified root hierarchy.

                            interface RatioSquarifyTilingFactory

                            interface RatioSquarifyTilingFactory {}

                              method ratio

                              ratio: (ratio: number) => RatioSquarifyTilingFactory;
                              • Specifies the desired aspect ratio of the generated rectangles. Note that the orientation of the generated rectangles (tall or wide) is not implied by the ratio. Furthermore, the rectangles ratio are not guaranteed to have the exact specified aspect ratio. If not specified, the aspect ratio defaults to the golden ratio, φ = (1 + sqrt(5)) / 2, per Kong et al.

                                Parameter ratio

                                The specified ratio value greater than or equal to one.

                              call signature

                              (
                              node: HierarchyRectangularNode<any>,
                              x0: number,
                              y0: number,
                              x1: number,
                              y1: number
                              ): void;

                                interface StratifyOperator

                                interface StratifyOperator<Datum> {}

                                  method id

                                  id: {
                                  (): (d: Datum, i: number, data: Datum[]) => string | null | '' | undefined;
                                  (id: (d: Datum, i: number, data: Datum[]) => string): this;
                                  };
                                  • Returns the current id accessor, which defaults to: (d) => d.id.

                                  • Sets the id accessor to the given function. The id accessor is invoked for each element in the input data passed to the stratify operator. The returned string is then used to identify the node's relationships in conjunction with the parent id. For leaf nodes, the id may be undefined, null or the empty string; otherwise, the id must be unique.

                                    Parameter id

                                    The id accessor.

                                  method parentId

                                  parentId: {
                                  (): (d: Datum, i: number, data: Datum[]) => string | null | '' | undefined;
                                  (parentId: (d: Datum, i: number, data: Datum[]) => string): this;
                                  };
                                  • Returns the current parent id accessor, which defaults to: (d) => d.parentId.

                                  • Sets the parent id accessor to the given function. The parent id accessor is invoked for each element in the input data passed to the stratify operator. The returned string is then used to identify the node's relationships in conjunction with the id. For the root node, the parent id should be undefined, null or the empty string. There must be exactly one root node in the input data, and no circular relationships.

                                    Parameter parentId

                                    The parent id accessor.

                                  call signature

                                  (data: Datum[]): HierarchyNode<Datum>;
                                  • Generates a new hierarchy from the specified tabular data. Each node in the returned object has a shallow copy of the properties from the corresponding data object, excluding the following reserved properties: id, parentId, children.

                                    Parameter data

                                    The root specified data.

                                    Throws

                                    Error on missing id, ambiguous id, cycle, multiple roots or no root.

                                  interface TreeLayout

                                  interface TreeLayout<Datum> {}

                                    method nodeSize

                                    nodeSize: { (): [number, number] | null; (size: [number, number]): this };
                                    • Returns the current node size, which defaults to null. A node size of null indicates that a layout size will be used instead.

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

                                      Parameter size

                                      The specified two-element size array.

                                    method separation

                                    separation: {
                                    (): (a: HierarchyPointNode<Datum>, b: HierarchyPointNode<Datum>) => number;
                                    (
                                    separation: (
                                    a: HierarchyPointNode<Datum>,
                                    b: HierarchyPointNode<Datum>
                                    ) => number
                                    ): this;
                                    };
                                    • Returns the current separation accessor, which defaults to: (a, b) => a.parent == b.parent ? 1 : 2.

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

                                      Parameter separation

                                      The separation function is passed two nodes 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.

                                    method size

                                    size: { (): [number, number] | null; (size: [number, number]): this };
                                    • Returns the current layout size, which defaults to [1, 1]. A layout size of null indicates that a node size will be used instead.

                                    • Sets this tree layout’s size to the specified [width, height] array and returns the tree 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.

                                      Parameter size

                                      The specified two-element size array.

                                    call signature

                                    (root: HierarchyNode<Datum>): HierarchyPointNode<Datum>;
                                    • Lays out the specified root hierarchy. You may want to call root.sort before passing the hierarchy to the tree layout.

                                      Parameter root

                                      The specified root hierarchy.

                                    interface TreemapLayout

                                    interface TreemapLayout<Datum> {}

                                      method padding

                                      padding: {
                                      (): (node: HierarchyRectangularNode<Datum>) => number;
                                      (padding: number): this;
                                      (padding: (node: HierarchyRectangularNode<Datum>) => number): this;
                                      };
                                      • Returns the current inner padding function.

                                      • Sets the inner and outer padding to the specified number and returns this treemap layout.

                                        Parameter padding

                                        The specified padding value.

                                      • Sets the inner and outer padding to the specified function and returns this treemap layout.

                                        Parameter padding

                                        The specified padding function.

                                      method paddingBottom

                                      paddingBottom: {
                                      (): (node: HierarchyRectangularNode<Datum>) => number;
                                      (padding: number): this;
                                      (padding: (node: HierarchyRectangularNode<Datum>) => number): this;
                                      };
                                      • Returns the current bottom padding function, which defaults to the constant zero.

                                      • Sets the bottom padding to the specified number and returns this treemap layout. The bottom padding is used to separate the bottom edge of a node from its children.

                                        Parameter padding

                                        The specified bottom padding value.

                                      • Sets the bottom padding to the specified function and returns this treemap layout. The function is invoked for each node with children, being passed the current node. The bottom padding is used to separate the bottom edge of a node from its children.

                                        Parameter padding

                                        The specified bottom padding function.

                                      method paddingInner

                                      paddingInner: {
                                      (): (node: HierarchyRectangularNode<Datum>) => number;
                                      (padding: number): this;
                                      (padding: (node: HierarchyRectangularNode<Datum>) => number): this;
                                      };
                                      • Returns the current inner padding function, which defaults to the constant zero.

                                      • Sets the inner padding to the specified number and returns this treemap layout. The inner padding is used to separate a node’s adjacent children.

                                        Parameter padding

                                        The specified inner padding value.

                                      • Sets the inner padding to the specified function and returns this treemap layout. The function is invoked for each node with children, being passed the current node. The inner padding is used to separate a node’s adjacent children.

                                        Parameter padding

                                        The specified inner padding function.

                                      method paddingLeft

                                      paddingLeft: {
                                      (): (node: HierarchyRectangularNode<Datum>) => number;
                                      (padding: number): this;
                                      (padding: (node: HierarchyRectangularNode<Datum>) => number): this;
                                      };
                                      • Returns the current left padding function, which defaults to the constant zero.

                                      • Sets the left padding to the specified number and returns this treemap layout. The left padding is used to separate the left edge of a node from its children.

                                        Parameter padding

                                        The specified left padding value.

                                      • Sets the left padding to the specified function and returns this treemap layout. The function is invoked for each node with children, being passed the current node. The left padding is used to separate the left edge of a node from its children.

                                        Parameter padding

                                        The specified left padding function.

                                      method paddingOuter

                                      paddingOuter: {
                                      (): (node: HierarchyRectangularNode<Datum>) => number;
                                      (padding: number): this;
                                      (padding: (node: HierarchyRectangularNode<Datum>) => number): this;
                                      };
                                      • Returns the current top padding function.

                                      • Sets the top, right, bottom and left padding to the specified function and returns this treemap layout.

                                        Parameter padding

                                        The specified padding outer value.

                                      • Sets the top, right, bottom and left padding to the specified function and returns this treemap layout.

                                        Parameter padding

                                        The specified padding outer function.

                                      method paddingRight

                                      paddingRight: {
                                      (): (node: HierarchyRectangularNode<Datum>) => number;
                                      (padding: number): this;
                                      (padding: (node: HierarchyRectangularNode<Datum>) => number): this;
                                      };
                                      • Returns the current right padding function, which defaults to the constant zero.

                                      • Sets the right padding to the specified number and returns this treemap layout. The right padding is used to separate the right edge of a node from its children.

                                        Parameter padding

                                        The specified right padding value.

                                      • Sets the right padding to the specified function and returns this treemap layout. The function is invoked for each node with children, being passed the current node. The right padding is used to separate the right edge of a node from its children.

                                        Parameter padding

                                        The specified right padding function.

                                      method paddingTop

                                      paddingTop: {
                                      (): (node: HierarchyRectangularNode<Datum>) => number;
                                      (padding: number): this;
                                      (padding: (node: HierarchyRectangularNode<Datum>) => number): this;
                                      };
                                      • Returns the current top padding function, which defaults to the constant zero.

                                      • Sets the top padding to the specified number and returns this treemap layout. The top padding is used to separate the top edge of a node from its children.

                                        Parameter padding

                                        The specified top padding value.

                                      • Sets the top padding to the specified function and returns this treemap layout. The function is invoked for each node with children, being passed the current node. The top padding is used to separate the top edge of a node from its children.

                                        Parameter padding

                                        The specified top padding function.

                                      method round

                                      round: { (): boolean; (round: boolean): this };
                                      • Returns the current rounding state, which defaults to false.

                                      • Enables or disables rounding according to the given boolean and returns this treemap layout.

                                        Parameter round

                                        The specified boolean flag.

                                      method size

                                      size: { (): [number, number]; (size: [number, number]): this };
                                      • Returns the current size, which defaults to [1, 1].

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

                                        Parameter size

                                        The specified two-element size array.

                                      method tile

                                      tile: {
                                      (): (
                                      node: HierarchyRectangularNode<Datum>,
                                      x0: number,
                                      y0: number,
                                      x1: number,
                                      y1: number
                                      ) => void;
                                      (
                                      tile: (
                                      node: HierarchyRectangularNode<Datum>,
                                      x0: number,
                                      y0: number,
                                      x1: number,
                                      y1: number
                                      ) => void
                                      ): this;
                                      };
                                      • Returns the current tiling method, which defaults to d3.treemapSquarify with the golden ratio.

                                      • Sets the tiling method to the specified function and returns this treemap layout.

                                        Parameter tile

                                        The specified tiling function.

                                      call signature

                                      (root: HierarchyNode<Datum>): HierarchyRectangularNode<Datum>;
                                      • Lays out the specified root hierarchy. You must call root.sum before passing the hierarchy to the treemap layout. You probably also want to call root.sort to order the hierarchy before computing the layout.

                                        Parameter root

                                        The specified root hierarchy.

                                      Package Files (1)

                                      Dependencies (0)

                                      No dependencies.

                                      Dev Dependencies (0)

                                      No dev dependencies.

                                      Peer Dependencies (0)

                                      No peer dependencies.

                                      Badge

                                      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/d3-hierarchy.

                                      • Markdown
                                        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/d3-hierarchy)
                                      • HTML
                                        <a href="https://www.jsdocs.io/package/@types/d3-hierarchy"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>