Skip to content

Generated html is blank #41

Description

@NguyenTuan-Dat

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)

Activity

  1. Luke-Poeppel commented on Oct 12, 2021

    @Luke-Poeppel
    Owner

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

  2. Luke-Poeppel commented on Oct 12, 2021

    @Luke-Poeppel
    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.)

  3. celeszter commented on Oct 14, 2021

    @celeszter

    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

  4. GuyTevet commented on Aug 4, 2022

    @GuyTevet

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions