I’m using virtualizedForceLayout sample. I made a little change for it. Instead of Loading data when init happens, I have a html button to fire load function when clicked. And i also changed load function like this:
During initialization of the page and the Diagram, its Diagram.viewportBounds changes. That calls onViewportChanged in order to create only the Nodes and Links that ought to be seen in the viewport. But at that time in your modified app, there’s nothing in myWholeModel, so there are no nodes or links to be created and shown.
Then you call generateNodes and generateLinks to fill up myWholeModel, but because the viewport hasn’t changed size, there’s no call to onViewportChanged in order to fill up the Diagram with Nodes and Links. So when I add a call to onViewportChanged, it seems to work well:
function load() {
// create a lot of data for the myWholeModel
generateNodes(myWholeModel, 1234, 1234);
generateLinks(myWholeModel, 1, 5);
// remove the status indicator
//myDiagram.remove(myLoading);
onViewportChanged({ diagram: myDiagram });
myDiagram.layoutDiagram(true);
}
I’m assuming you commented out creating the myLoading indicator and the call to Diagram.delayInitialization.
It doesn’t work well. it still comes out, but you can see some parts separate from main tree and some nodes even have no links connected. It’s just like what i got before you gave me the solution.