sisl / D3Trees.jl

Flexible interactive visualization for large trees in Julia using D3.js
Other
39 stars 7 forks source link

Save the D3Tree as html file (improvement?). #30

Closed Piaktipik closed 2 years ago

Piaktipik commented 2 years ago

It will be great to have an example of how to store a D3Tree in HTML.

For example, instead of: inchrome(D3Tree(info[:tree], init_expand=0, title="TreeStep-$c" ))

Something like:

saveTree(D3Tree(info[:tree], init_expand=0, title="TreeStep-$c" ), pathHTLMOutputFile)

So the tree can later be inspected using a particular browser.

nsajko commented 2 years ago

@Piaktipik I agree with this feature request, but FTR I think that a simple workaround exists, do something like this:

inbrowser(d3tree, "echo")

As a result, echo should echo its argument (the URL) back to your terminal stdout.

Piaktipik commented 2 years ago

@nsajko, that is a great workaround. With the link, it will be a matter of copying it from there (/tmp/jl_6l5v9e/tree.html) to the path of interest, I will do that, thank you!

Just in case someone else wants a workaround, below is a sub-optimal way that worked for me:

pathTree = inbrowser(D3Tree(info[:tree], init_expand=0, title="TreeTitle" ), "echo")
pathTreeStr = string(pathTree)
pathTreeStrExt = chop(split(pathTreeStr," ")[2],tail=2)     # Pick path only
mv(pathTreeStrExt, "$pathToSaveTree/treeName.html")