-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
documentation for the tree mark and the treeLink, treeNode transforms #1351
Conversation
src/marks/tree.d.ts
Outdated
textStroke?: MarkOptions["stroke"]; | ||
} | ||
|
||
/** | ||
* Transforms a tabular dataset into a hierarchy according to the given **path** input channel, which is typically a slash-separated string; then executes a tree layout algorithm to compute **x** and **y** output channels; these channels can then be fed to other marks to construct a node-link diagram. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs wrapping. (I will fix.)
src/transforms/tree.d.ts
Outdated
treeSort?: CompareFunction | {node: (node: any) => any} | string | null; | ||
} | ||
|
||
/** | ||
* Based on the **tree** options (**path**, **delimiter**, **treeAnchor**, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation should have one space, not two. (I will fix.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I don’t think we need to repeat the tree options here. They should be clear from autocomplete (or jumping to the TreeTransformOptions interface).
src/marks/tree.d.ts
Outdated
@@ -6,10 +6,32 @@ import type {TextOptions} from "./text.js"; | |||
|
|||
// TODO tree channels, e.g., "node:name" | "node:path" | "node:internal"? | |||
export interface TreeOptions extends DotOptions, LinkOptions, TextOptions, TreeTransformOptions { | |||
/** | |||
* Should the node be represented by a dot. Defaults to true unless a **marker** is specified. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can’t really explain why, but I think grammatically this should read as “whether to represent the node with a dot” instead of “should the node be represented by a dot”. “Should” can imply correctness or appropriateness, but we’re not really making a judgment about what is correct or appropriate here, just honoring the user’s intention. (I will fix.)
* * **treeSort** - a node comparator, or null to preserve input order | ||
* * **treeSeparation** - a node separation function, or null for uniform separation | ||
* | ||
*/ | ||
export function tree(data?: Data, options?: TreeOptions): CompoundMark; | ||
|
||
export function cluster(data?: Data, options?: TreeOptions): CompoundMark; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing documentation. (I have fixed.)
src/transforms/tree.d.ts
Outdated
delimiter?: string; | ||
/** | ||
* If the **treeAnchor** is *left*, the root of the tree will be aligned with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These options could use a summary sentence prior to diving into the possible ways in which the options could be specified. For example:
- treeAnchor - how to orient the tree
- treeLayout - how to position nodes in the tree
- treeSeparation - how much space to reserve between adjacent nodes
- treeSort - how to order nodes prior to computing the layout
etc.
…observablehq#1351) * documentation for the tree mark and the treeLink, treeNode transforms * tweaks * tweaks --------- Co-authored-by: Mike Bostock <mbostock@gmail.com>
For #1343
We could possibly add more information, like how dx defaults to +6 if the anchor is left, etc.