In my application I am sometimes loading up a fairly large and complex model that has a noticeable rendering delay of up to 30s. I’d like to display a spinner until the model has fully rendered. I have not been able to find a diagram event listed under DiagramEvent | GoJS API that coincides with the model rendering being complete. Everything I have tried such as LayoutCompleted fires to early, the closest is the AnimationFinished event, however I’d prefer to disable the initial animation.
The “InitialLayoutCompleted” DiagramEvent is raised after replacing the Diagram.model causes the model to be loaded, the Nodes and Links to be created and added to the Diagram, those Parts to be data-bound, the Layouts to be performed, the Diagram.documentBounds to be calculated, the diagram document to be scrolled and zoomed as appropriate, and the scrollbars to be updated.
I believe you are correct that the actual rendering of the diagram happens immediately after the “InitialLayoutCompleted” DiagramEvent, but I’m surprised that there would be a long delay between that time and the time at which the canvas is fully rendered. That’s why “InitialLayoutCompleted” is the normal event to use for such purposes.
And I believe you are correct about the “AnimationFinished” DiagramEvent. But I suppose you could set the AnimationManager.duration to 1 initially, and then reset it to 600 or whatever milliseconds in the first “AnimationFinished” DiagramEvent. If you load another model you’ll need to set it back to 1 first.