Initialposition

Hi, i am trying to set the initial position , but my diagram is always displayed in the (0,0) position.

 fg(go.Diagram, divId, {
                initialPosition : new go.Point(600,600),
                autoScrollRegion: new go.Margin(20, 20, 20, 20),
                'LinkDrawn': createLinkViaRelink, //NO I18n 
                'animationManager.isEnabled': false, //NO I18n
                'undoManager.isEnabled': true, //NO I18n
                maxSelectionCount:1, //NO I18n
                allowClipboard:false,//NO I18n
                doubleClick: diagramDoubleClick,
                LinkReshaped: function(e) { //NO I18n
                    e.subject.routing = go.Link.Orthogonal;
                },
            });

i am not able to position the diagram in your example as well , plz check the video
https://docs.zoho.com/file/bhy44271ea7ad654b4139827c0bdedcf5539f

Probably because the positions that you are setting are invalid, because they do not contain the whole diagram, and GoJS forces the view to contain the whole diagram.

You could set something like:

myDiagram.scrollMode = go.Diagram.InfiniteScroll;

to stop that. Then you could set any position arbitrarily. But you probably do not want to do this.

Simon

well setting infinite scroll will let the user scroll all the way , so i dont prefer that , can i use myDiagram.centerRect(Diagram.actualBounds); to center the diagram ?

You could call

myDiagram.alignDocument(go.Spot.Center, go.Spot.Center)

Thanks will try and let you know

It just occured to me. Depending on what you’re doing, you might just want to set

initialContentAlignment: go.Spot.Center

on the diagram.