diff --git a/src/marks/tree.js b/src/marks/tree.js index 4345f08de4..a58238fc7f 100644 --- a/src/marks/tree.js +++ b/src/marks/tree.js @@ -31,6 +31,7 @@ export function tree( textAnchor, treeLayout = Tree, textLayout = treeLayout === Tree || treeLayout === Cluster ? "mirrored" : "normal", + tip, ...options } = {} ) { @@ -74,7 +75,7 @@ export function tree( }) ), dotDot - ? dot(data, treeNode({treeLayout, fill: fill === undefined ? "node:internal" : fill, title, ...options})) + ? dot(data, treeNode({treeLayout, fill: fill === undefined ? "node:internal" : fill, title, tip, ...options})) : null, textText != null ? textLayout === "mirrored" diff --git a/test/output/greekGodsTip.svg b/test/output/greekGodsTip.svg new file mode 100644 index 0000000000..212fbf4e05 --- /dev/null +++ b/test/output/greekGodsTip.svg @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + Eros/Chaos/Eros + Erebus/Chaos/Erebus + Tartarus/Chaos/Tartarus + Mountains/Chaos/Gaia/Mountains + Pontus/Chaos/Gaia/Pontus + Uranus/Chaos/Gaia/Uranus + + + Chaos/Chaos + Gaia/Chaos/Gaia + + + \ No newline at end of file diff --git a/test/plots/greek-gods.ts b/test/plots/greek-gods.ts index 0e4136afd8..e917783d46 100644 --- a/test/plots/greek-gods.ts +++ b/test/plots/greek-gods.ts @@ -19,6 +19,25 @@ Chaos Tartarus` }); } +export async function greekGodsTip() { + const gods = `Chaos Gaia Mountains +Chaos Gaia Pontus +Chaos Gaia Uranus +Chaos Eros +Chaos Erebus +Chaos Tartarus` + .split("\n") + .map((d) => d.replace(/\s+/g, "/")); + return Plot.plot({ + axis: null, + insetLeft: 35, + insetTop: 20, + insetBottom: 20, + insetRight: 120, + marks: [Plot.tree(gods, {tip: true})] + }); +} + export async function greekGodsExplicit() { const gods = `Chaos Gaia Mountains Chaos Gaia Pontus