Prevent the diagram from expanding

Hello I was wondering if there is a way to set a fixed size to a diagram because, it keeps expanding whenever there is not enough space or it passes the diagram boundaries

I’m not sure what you mean. There’s discussion of this and related topics at GoJS Coordinate Systems-- Northwoods Software.

Perhaps you are asking to set Diagram.fixedBounds? This way the area that the user can scroll is always the same size, regardless of where any Nodes are.

Yes that is what i meant, is there any example using the fixedBounds property?

Well, a quick search finds four uses of that property in the samples.

You might be most interested in Content Alignment examples for demonstration, and in Absolute positioning within the viewport for example.