Skip to content

documentation for the tree mark and the treeLink, treeNode transforms#1351

Merged
mbostock merged 3 commits into
mainfrom
fil/ts-tree
Mar 20, 2023
Merged

documentation for the tree mark and the treeLink, treeNode transforms#1351
mbostock merged 3 commits into
mainfrom
fil/ts-tree

Conversation

@Fil
Copy link
Copy Markdown
Contributor

@Fil Fil commented Mar 17, 2023

For #1343

We could possibly add more information, like how dx defaults to +6 if the anchor is left, etc.

@Fil Fil requested a review from mbostock March 17, 2023 11:15
Comment thread src/marks/tree.d.ts Outdated
}

/**
* 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.
Copy link
Copy Markdown
Member

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

Comment thread src/transforms/tree.d.ts Outdated
}

/**
* Based on the **tree** options (**path**, **delimiter**, **treeAnchor**,
Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member

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

Comment thread src/marks/tree.d.ts Outdated
// 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.
Copy link
Copy Markdown
Member

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

Comment thread src/marks/tree.d.ts
*/
export function tree(data?: Data, options?: TreeOptions): CompoundMark;

export function cluster(data?: Data, options?: TreeOptions): CompoundMark;
Copy link
Copy Markdown
Member

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

Comment thread src/transforms/tree.d.ts Outdated
*/
delimiter?: string;
/**
* If the **treeAnchor** is *left*, the root of the tree will be aligned with
Copy link
Copy Markdown
Member

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.

@mbostock mbostock merged commit 2ac08e2 into main Mar 20, 2023
@mbostock mbostock deleted the fil/ts-tree branch March 20, 2023 17:22
Comment thread src/marks/tree.d.ts
chaichontat pushed a commit to chaichontat/plot that referenced this pull request Jan 14, 2024
…observablehq#1351)

* documentation for the tree mark and the treeLink, treeNode transforms

* tweaks

* tweaks

---------

Co-authored-by: Mike Bostock <mbostock@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants