Diagram.documentBounds:

Diagram.contentAlignment:



Diagram.position:

Diagram.scale:

Diagram.fixedBounds (x, y, width, height):

Diagram.padding (top, right, bottom, left):

Diagram.autoScale:



(but no greater than CommandHandler.defaultScale)

A Diagram's Diagram.contentAlignment property determines how parts are positioned when the Diagram.viewportBounds width or height is different than the Diagram.documentBounds width or height.

Diagram.position changes where in the document the view port is located. This means that Diagram.position is always equal to Diagram.viewportBounds x and y.

Diagram.scale changes how zoomed in/out the diagram is.

Diagram.fixedBounds changes the bound returned by Diagram.documentBounds, by default this is NaN, NaN, NaN, NaN meaning that Diagram.documentBounds returns Diagram.computeBounds.

Diagram.padding is the extra space between the nodes and the edge of the canvas.

Diagram.autoScale automatically sets the Diagram.scale and Diagram.position of the diagram to fit the document bounds inside the view. AutoScale.Uniform will fit the document to the view. AutoScale.UniformToFill will scale and position the diagram such that in on direction it fits the view, and the other requires a scroll bar.


GoJS Features in this sample

HTML Interaction

GoJS Diagrams can be used alongside other HTML elements in a webapp. For custom Text Editors, Context Menus, and ToolTips, which are invoked and hidden via GoJS tool operations, it is best to use the HTMLInfo class.

More information can be found in the GoJS Intro.

Related samples