Skip to content
Back to skills

2268 Tree Cd5ec4b9

ASecurity

The tree mark creates hierarchical tree diagrams from path-based data.

  • 9 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added May 31, 2026
developmentjavascriptjavanode

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned May 31, 2026

npx -y skills add tools-only/X-Skills --skill 2268-tree_cd5ec4b9 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 2268 Tree Cd5ec4b9?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 2268 Tree Cd5ec4b9
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-2268-tree-cd5ec4b9/badge)](https://www.skillsdirectory.com/skills/tools-only-2268-tree-cd5ec4b9)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Tree Mark

The tree mark creates hierarchical tree diagrams from path-based data.

## Constructors

```javascript
Plot.tree(data, options)     // Tidy tree layout
Plot.cluster(data, options)  // Cluster layout (leaf-aligned)
```

## Data Format

Path-delimited strings representing hierarchy:

```javascript
const data = [
  "root/child1/grandchild1",
  "root/child1/grandchild2",
  "root/child2/grandchild3"
];
```

## Examples

### Basic Tree
```javascript
Plot.tree(hierarchy).plot()
```

### With Text Labels
```javascript
Plot.tree(hierarchy, {
  textStroke: "white"  // Label halo
}).plot()
```

### Cluster Layout
```javascript
Plot.cluster(hierarchy).plot()
```

### Flare Visualization
```javascript
Plot.tree(flare, {
  textStroke: "white",
  treeLayout: d3.tree,
  dx: 10,
  dy: 100
}).plot({
  height: 2000,
  marginLeft: 100
})
```

### Custom Node Styling
```javascript
Plot.tree(data, {
  fill: "node:internal",  // Color internal vs leaf nodes
  stroke: "node:internal"
}).plot()
```

### Horizontal Tree
```javascript
Plot.tree(hierarchy, {
  textLayout: "normal",
  treeLayout: d3.tree().nodeSize([20, 150])
}).plot({
  marginLeft: 100,
  marginRight: 100
})
```

## Options

| Option | Default | Description |
|--------|---------|-------------|
| `path` | identity | Slash-separated path accessor |
| `treeLayout` | d3.tree | Layout function |
| `textLayout` | varies | Label positioning ("mirrored" or "normal") |
| `text` | node:name | Label text |
| `title` | node:path | Tooltip text |
| `fill` | node:internal | Node color |
| `stroke` | fill | Link color |
| `textStroke` | white | Label halo color |
| `dot` | false | Show node dots |
| `dx` | 6 | Horizontal text offset |
| `dy` | 0 | Vertical text offset |

## Node Properties

Special node accessors:
- `node:name` - Node name (last path segment)
- `node:path` - Full path
- `node:internal` - Boolean (true for non-leaf nodes)
- `node:depth` - Depth in tree
- `node:height` - Height (distance to deepest leaf)

## Components

The tree mark is a composite of:
1. **Links** - Parent-child connections (treeLink transform)
2. **Dots** - Node circles (optional)
3. **Text** - Node labels

## Notes

- Manual height and margin adjustment often required
- Use `cluster` for leaf-aligned layouts
- The `textLayout: "mirrored"` option mirrors labels on left/right sides
- Supports custom d3 tree layouts via `treeLayout` option

Files in this skill

  • README.md775 B
  • skill.md2.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.