There is one problem with this solution is that my legend is coming on top of the graph.
Is there any way to load the graph with some space on right side for legend
As legends have isInDocumentBounds: false, it comes over the graph( due to layerName: ‘Foreground’, property). If I could shift the graph towards left leaving the space for legend, that will be very nice.
Are you sure you want to keep the legend at a particular place in the viewport, rather than letting the user scroll and zoom the legend along with everything else in the diagram?
Doing what you are doing will necessarily mean that some of the time the legend will be overlapping with the main parts of the diagram, depending on how the user scrolls and zooms around.
I understand that the legend will always be on top of nodes.
The issue is for the top left corner node there is no scroll space left.
I just want my diagram to shift a bit to left.
Something like -
initialDocumentSpot: go.Spot.TopLeft + 20