Skip to content

Commit 7f67431

Browse files
authored
closes #1723 (#1726)
I pondered a bit what happened if dotDot was false: we could then add the tip option on the text mark, but this would in turn create more complexity. Decided to keep it simple.
1 parent f77ac3a commit 7f67431

File tree

3 files changed

+69
-1
lines changed

3 files changed

+69
-1
lines changed

src/marks/tree.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export function tree(
3131
textAnchor,
3232
treeLayout = Tree,
3333
textLayout = treeLayout === Tree || treeLayout === Cluster ? "mirrored" : "normal",
34+
tip,
3435
...options
3536
} = {}
3637
) {
@@ -74,7 +75,7 @@ export function tree(
7475
})
7576
),
7677
dotDot
77-
? dot(data, treeNode({treeLayout, fill: fill === undefined ? "node:internal" : fill, title, ...options}))
78+
? dot(data, treeNode({treeLayout, fill: fill === undefined ? "node:internal" : fill, title, tip, ...options}))
7879
: null,
7980
textText != null
8081
? textLayout === "mirrored"

test/output/greekGodsTip.svg

Lines changed: 48 additions & 0 deletions
Loading

test/plots/greek-gods.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,25 @@ Chaos Tartarus`
1919
});
2020
}
2121

22+
export async function greekGodsTip() {
23+
const gods = `Chaos Gaia Mountains
24+
Chaos Gaia Pontus
25+
Chaos Gaia Uranus
26+
Chaos Eros
27+
Chaos Erebus
28+
Chaos Tartarus`
29+
.split("\n")
30+
.map((d) => d.replace(/\s+/g, "/"));
31+
return Plot.plot({
32+
axis: null,
33+
insetLeft: 35,
34+
insetTop: 20,
35+
insetBottom: 20,
36+
insetRight: 120,
37+
marks: [Plot.tree(gods, {tip: true})]
38+
});
39+
}
40+
2241
export async function greekGodsExplicit() {
2342
const gods = `Chaos Gaia Mountains
2443
Chaos Gaia Pontus

0 commit comments

Comments
 (0)