@g.bartoli wrote:
Hi Walter,
I managed to produce a graph with a behavior similar to the Fishbone example where buttons are used to dynamically change the layout (I'm switching between TreeLayout and ForceDirectedLayout).However, I would like the zoom to be adjusted to fit both graphs when changing them, because at the moment the zoom remains fixed to the initial level I set with
initialAutoScale: go.Diagram.Uniform
in the Diagram. For the first view it's fine, but it should changed to fit also the second view.These are my simple switching functions connected to the button callbacks:
function setTreeLayout() { myDiagram.startTransaction("tree_layout"); myDiagram.layout = $(go.TreeLayout, { nodeSpacing: 40, layerSpacing: 180 }); myDiagram.commitTransaction("tree_layout"); } function setDynamicLayout() { myDiagram.startTransaction("dynamic_layout"); myDiagram.layout = $(go.ForceDirectedLayout, { defaultSpringLength: 30, defaultElectricalCharge: 200 }); myDiagram.commitTransaction("dynamic_layout"); }
Do you know which is the fastest way to update the zoom level?
Thanks,
Guido
Posts: 4
Participants: 2