Skip to content

How do you refresh the graph? #4

Description

@creativecontrol

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");
    }

Activity

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