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

How do you refresh the graph? #4

Open
creativecontrol opened this issue Jan 14, 2021 · 0 comments
Open

How do you refresh the graph? #4

creativecontrol opened this issue Jan 14, 2021 · 0 comments

Comments

@creativecontrol
Copy link

creativecontrol commented Jan 14, 2021

Hello,

Thanks for making such a simple renderer for ELK. It is very easy to understand and make adjustments to for my needs.
I was wondering about a feature that you have in your Editor on the site; Redraw. From what I can tell it is calling a function which just runs hdelk.layout() again with the new information. I've been attempting the same thing but it adds additional labels and ports to the existing SVG objects rather than clearing and redrawing. I've tried several ways of removing and clearing the SVG object from the page but the diagram is still cached in some way. I've attached a couple screenshots to show the issue.

Thanks for your help

One first load:
image

After running hdelk.layout() 2 more times with the same data:
image

The code I'm using to chose the graph to display"

function displayDiagram(mode="show") {

        let fullGraph = {}; 

        if(mode == "show") {
            fullGraph = {
                children: [
                    ...graph.children,
                    ...networkConns.children
                ],
                edges: [
                    ...graph.edges,
                    ...networkConns.edges
                ]
            }

            
        } else if (mode == "hide") {
            fullGraph = graph;

        }

        console.log("fullGraph",fullGraph);

        hdelk.layout(fullGraph, "graph");
    }
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

1 participant