Learn AspNet
Learn AspNet

Reputation: 1612

Focus/Zoom in on part of the graph or a specific set of nodes or a single node

I am currently using Cytoscape to create a large graph with 500 nodes. I am using Dagre for the hierarchical layout. Currently the graph is small on the screen because of number of nodes which makes sense but

Is there a way to focus on a single node once the graph is created. Or can I zoom in on a part of graph?

I have tried using animate filter on dagre but it animates the whole graph and does not focus or zoom in on one node or one part of the graph.

    this.cy
        .layout({
            name: "dagre",
            padding: 30,
            animate: true, // whether to transition the node positions
            animateFilter: function( node, i ){         
                if ( node[0]._private.data.type === "student") {
                    return true;
                }
            },
            transform: function( node, pos ){ return pos; },
        })
        .run();

Also tried zoom, But I only want to zoom one or set of nodes at the same time

cy.zoom({
        level: 1.1, // the zoom level
        //How can I filter the nodes I want?
      });

Upvotes: 2

Views: 983

Answers (0)

Related Questions