@@ -2,14 +2,107 @@ import type {ChannelValue} from "../channel.js";
22import type { CompareFunction , Transformed } from "./basic.js" ;
33
44export interface TreeTransformOptions {
5+ /**
6+ * The location of each node in the hierarchy; typically slash-separated
7+ * strings, as with UNIX-based file systems or URLs. Defaults to identity,
8+ * assuming the mark’s data are path strings.
9+ */
510 path ?: ChannelValue ;
11+
12+ /**
13+ * The path separator, used for inferring the hierarchy from the **path**
14+ * channel; defaults to forward slash (/).
15+ */
616 delimiter ?: string ;
17+
18+ /**
19+ * How to orient the tree. If the **treeAnchor** is *left*, the root of the
20+ * tree will be aligned with the left side of the frame; if **treeAnchor** is
21+ * *right*, the root of the tree will be aligned with the right side of the
22+ * frame; use the **insetLeft** and **insetRight** *x* scale options if
23+ * horizontal padding is desired, say to make room for labels.
24+ */
725 treeAnchor ?: "left" | "right" ;
26+
27+ /**
28+ * How to layout the tree. The default **treeLayout** implements the
29+ * Reingold–Tilford “tidy” algorithm. Use
30+ * [d3.cluster](https://github.com/d3/d3-hierarchy/blob/main/README.md#cluster)
31+ * instead to align leaf nodes; see also Plot.cluster.
32+ */
833 treeLayout ?: ( ) => any ;
34+
35+ /**
36+ * How much space to reserve between adjacent nodes in the layout. If the
37+ * **treeSeparation** is not null, it is a function that is passed two nodes
38+ * in the hierarchy and returns the desired (relative) amount of separation;
39+ * see [d3-hierarchy’s
40+ * _tree_.separation](https://github.com/d3/d3-hierarchy/blob/main/README.md#tree_separation)
41+ * for more. By default, non-siblings are at least twice as far apart as
42+ * siblings.
43+ */
944 treeSeparation ?: CompareFunction | null ;
45+
46+ /**
47+ * How to order nodes prior to laying them out. If the **treeSort** option is
48+ * not null, it is typically a function that is passed two nodes in the
49+ * hierarchy and compares them, similar to
50+ * [_array_.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort);
51+ * see [d3-hierarchy’s
52+ * _node_.sort](https://github.com/d3/d3-hierarchy/blob/main/README.md#node_sort)
53+ * for more. The **treeSort** option can also be specified as a string, in
54+ * which case it refers either to a named column in data, or if it starts with
55+ * “node:”, a node value such as node:name.
56+ */
1057 treeSort ?: CompareFunction | { node : ( node : any ) => any } | string | null ;
1158}
1259
60+ /**
61+ * Populates the *x* and *y* channels with the positions for each node, and
62+ * applies a default **frameAnchor** based on the specified **treeAnchor**. This
63+ * transform is intended to be used with dot, text, and other point-based marks.
64+ * This transform is rarely used directly; see the tree mark.
65+ *
66+ * The treeNode transform will derive output columns for any *options* that have
67+ * one of the following named node values:
68+ *
69+ * * *node:name* - the node’s name (the last part of its path)
70+ * * *node:path* - the node’s full, normalized, slash-separated path
71+ * * *node:internal* - true if the node is internal, or false for leaves
72+ * * *node:depth* - the distance from the node to the root
73+ * * *node:height* - the distance from the node to its deepest descendant
74+ *
75+ * In addition, if any option value is specified as an object with a **node**
76+ * method, a derived output column will be generated by invoking the **node**
77+ * method for each node in the tree.
78+ */
1379export function treeNode < T > ( options ?: T & TreeTransformOptions ) : Transformed < T > ;
1480
81+ /**
82+ * Populates the *x1*, *y1*, *x2*, and *y2* channels, and applies the following
83+ * defaults: **curve** is *bump-x*, **stroke** is #555, **strokeWidth** is 1.5,
84+ * and **strokeOpacity** is 0.5. This transform is intended to be used with
85+ * link, arrow, and other two-point-based marks. This transform is rarely used
86+ * directly; see the tree mark.
87+ *
88+ * The treeLink transform will derive output columns for any *options* that have
89+ * one of the following named link values:
90+ *
91+ * * *node:name* - the child node’s name (the last part of its path)
92+ * * *node:path* - the child node’s full, normalized, slash-separated path
93+ * * *node:internal* - true if the child node is internal, or false for leaves
94+ * * *node:depth* - the distance from the child node to the root
95+ * * *node:height* - the distance from the child node to its deepest descendant
96+ * * *parent:name* - the parent node’s name (the last part of its path)
97+ * * *parent:path* - the parent node’s full, normalized, slash-separated path
98+ * * *parent:depth* - the distance from the parent node to the root
99+ * * *parent:height* - the distance from the parent node to its deepest descendant
100+ *
101+ * In addition, if any option value is specified as an object with a **node**
102+ * method, a derived output column will be generated by invoking the **node**
103+ * method for each child node in the tree; likewise if any option value is
104+ * specified as an object with a **link** method, a derived output column will
105+ * be generated by invoking the **link** method for each link in the tree, being
106+ * passed two node arguments, the child and the parent.
107+ */
15108export function treeLink < T > ( options ?: T & TreeTransformOptions ) : Transformed < T > ;
0 commit comments