Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated html is blank #41

Open
NguyenTuan-Dat opened this issue Oct 11, 2021 · 4 comments
Open

Generated html is blank #41

NguyenTuan-Dat opened this issue Oct 11, 2021 · 4 comments

Comments

@NguyenTuan-Dat
Copy link

NguyenTuan-Dat commented Oct 11, 2021

I'm tried follow the tutorial but output is blank like this image.
Screen Shot 2021-10-11 at 11 05 22

This is my code, can you help me check my mistake?

from treeplotter.tree import Node, Tree, ConnectorStyle, NodeStyle, create_tree_diagram
root = Node(name="root")
arrow_connector = ConnectorStyle(
    arrow_end="classic",  # these come from the Raphaël documentation.
    arrow_width="wide",
    arrow_length="long")
node_style = NodeStyle(
    background_color="#89ADF0",
    border_radius="10px")
root_child = []
for node in tree:
    parent_node = Node(name=some_name, image=img_path)
    childs = []
    childrens_node = tree[node].get_childrens()
    for child in childrens_node:
        child_node = Node(name=some_name, image=img_path)
        childs.append(child_node)
    parent_node.add_children(childs)
    root_child.append(parent_node)
root.add_children(root_child)
print(root.num_children)
connected_tree = Tree(root=root, connector_type="step", connector_style=arrow_connector, orientation="west",
                      node_style=node_style)
create_tree_diagram(tree=connected_tree,
                    save_path="/Users/ntdat/Downloads/tree",
                    background_color="#cf2b2b",
                    webshot=True,
                    verbose=True)
@Luke-Poeppel
Copy link
Owner

Luke-Poeppel commented Oct 12, 2021

Thanks for filing this issue @NguyenTuan-Dat ! I will take a look at this today and get back to you ASAP.

@Luke-Poeppel
Copy link
Owner

Thanks again for filing @NguyenTuan-Dat ! I need a bit more info for the following before I can debug:

  • It looks like you're defining a tree somewhere outside of the above snippet (see for node in tree). I can't run the snippet without seeing how tree is defined.
  • I think you added some methods to Tree (get_childrens, tree indexing tree[node]). This is really cool, and please feel free to submit a Pull Request with these contributions! I can't run the snippet without these methods.

Could you send a minimal reproducible example with your issue? (Also: it looks from the above image that you're previewing your .html file with the spacebar –– as far as I know, the tree image cannot be rendered from preview; it'll only be visible if you open the file in the browser.)

@celeszter
Copy link

celeszter commented Oct 14, 2021

Hi, my html is also blank.
Here is the code I used (basically same as the tutorial)

from treeplotter.tree import Node, Tree
root = Node(value=1.0, name=None)

child1 = Node(value=0.5, name=None)
child2 = Node(value=1.0, name=None)
child3 = Node(value=3.0, name="A")
root.children = {child1, child2, child3}
root.children

granchild1 = Node(value=0.5, name=None)
granchild2 = Node(value=3.0, name="B")
granchild3 = Node(value=2.0, name="C")
greatgrandchild = Node(value=1.0, name="D")

child1.add_children([granchild1, granchild2])
child2.add_child(granchild3)
granchild1.add_child(greatgrandchild)


tree = Tree(root=root)

from treeplotter.plotter import create_tree_diagram
create_tree_diagram(
    tree=tree,
    save_path="C:\Eszter\stuff",
    webshot=True,
    verbose=True
)

I am attaching the output files:
stuff.zip

Thank you for your help on this

@GuyTevet
Copy link

GuyTevet commented Aug 4, 2022

Running the same code as @celeszter , I'm getting blank HTML as well, and the following JS error:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants