Skip to content

Commit

Permalink
closes #1723 (#1726)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Fil authored Jun 26, 2023
1 parent f77ac3a commit 7f67431
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/marks/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export function tree(
textAnchor,
treeLayout = Tree,
textLayout = treeLayout === Tree || treeLayout === Cluster ? "mirrored" : "normal",
tip,
...options
} = {}
) {
Expand Down Expand Up @@ -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"
Expand Down
48 changes: 48 additions & 0 deletions test/output/greekGodsTip.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions test/plots/greek-gods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7f67431

Please sign in to comment.