You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/marks/tree.md
+8-5Lines changed: 8 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -75,7 +75,7 @@ Plot.plot({
75
75
```
76
76
:::
77
77
78
-
The **treeLayout** option specifies the layout algorithm. The tree mark uses the Reingold–Tilford “tidy” tree algorithm, [d3.tree](https://github.com/d3/d3-hierarchy/blob/main/README.md#tree), by default. The [cluster](#cluster-data-options) convenience method sets **treeLayout** to [d3.cluster](https://github.com/d3/d3-hierarchy/blob/main/README.md#cluster), aligning the leaf nodes. Both default the **textBalanced** option to true, drawing non-leaf node labels to the left of the node.
78
+
The **treeLayout** option specifies the layout algorithm. The tree mark uses the Reingold–Tilford “tidy” tree algorithm, [d3.tree](https://github.com/d3/d3-hierarchy/blob/main/README.md#tree), by default. The [cluster](#cluster-data-options) convenience method sets **treeLayout** to [d3.cluster](https://github.com/d3/d3-hierarchy/blob/main/README.md#cluster), aligning the leaf nodes.
@@ -151,13 +151,16 @@ The following options are supported:
151
151
***title** - the text and dot title; defaults to *node:path*
152
152
***text** - the text label; defaults to *node:name*
153
153
***textStroke** - the text stroke; defaults to *white*
154
-
***textBalanced** - the orientation of non-leaf labels
155
-
***dx** - the text horizontal offset; defaults to 6 if left-anchored, or -6 if right-anchored
154
+
***textLayout** - the text anchoring layout
155
+
***dx** - the text horizontal offset; defaults to 6
156
156
***dy** - the text vertical offset; defaults to 0
157
157
158
158
Any additional *options* are passed through to the constituent link, dot, and text marks and their corresponding treeLink or treeNode transform.
159
159
160
-
Text labels for leaf nodes are drawn to the right of the node; the **textBalanced** option controls whether labels for non-leaf nodes are drawn to the left of the node. It defaults to true, unless a **treeLayout** is specified (*e.g.*, the custom indent layout above).
160
+
The **textLayout** option controls how text labels are anchored to the node. Two layouts are supported:
161
+
162
+
**mirrored* - leaf-node labels are left-anchored, and non-leaf nodes right-anchored (with a -dx offset); default unless a **treeLayout** is specified
163
+
**normal* - all labels are left-anchored; default if a **treeLayout** is specified
161
164
162
165
## tree(*data*, *options*)
163
166
@@ -173,4 +176,4 @@ Returns a new tree mark with the given *data* and *options*.
173
176
Plot.cluster(flare, {path:"name", delimiter:"."})
174
177
```
175
178
176
-
Like [tree](#tree-data-options), except sets the **treeLayout** option to [d3.cluster](https://github.com/d3/d3-hierarchy/blob/main/README.md#cluster), aligning leaf nodes.
179
+
Like [tree](#tree-data-options), except sets the **treeLayout** option to [d3.cluster](https://github.com/d3/d3-hierarchy/blob/main/README.md#cluster), aligning leaf nodes, and defaults the **textLayout** option to *mirrored*.
0 commit comments