How to re-allign a gojs flow chart?

Is there a way to align the roughly created flowchart by user ?

Attached here is a sample rough flowchart–>>

and its desired output should be like this–>>

You could try setting Diagram.layout to a LayeredDigraphLayout. That’s what the Flowgrammer sample does,


This is not what i am looking for.

I want my GoJS original flowchart to be aligned (as shown in picture), upon some button click, after the user has created the flowchart.

I tried setting the layout as LayeredDigraphLayout, but that didn’t work for me.

The Page Flow sample,, demonstrates what I think you are looking for. Basically you want to set Layout.isOngoing to false and you want your button to call Diagram.layoutDiagram. If you are keeping node locations in your model, you probably also want to set Layout.isInitial to false as well.

The Fishbone sample,, demonstrates another way for a button to cause a (different) layout to occur.

Hey Walter,
That worked, it allowed me to align the diagram upon button click.

However, the diagram is aligned horizontally like this–>>

I want the diagram to be aligned vertically like this -->>

Is there another property or setting that needs to be set to achieve this ?

LayeredDigraphLayout.direction. Please read the documentation,, and play interactively with the properties at

Thanks Walter,
Got the feature i was looking for.