Scale subgraph

Hi,

I would like to scale nodes and links in a group without scaling the entire diagram.

Doesn’t seem possible because subgraphs don’t constitute a new diagram.

Is there a way to do it ?

Thanks.

That is correct – the subgraph within a group cannot be drawn at a different scale than the rest of the diagram. How would a link be drawn that connects a node within such a subgraph with a node outside the subgraph?

But you could modify the scale of each member node of a group. Consider Regrouping Demo with shrinking members

Thank you for your reply and example.

Problem is I also have links in the group; the links are only within the subgraph. When I individually scale the nodes and links, the final result is… ugly: the elements are scaled but stay at their initial position.

I may need to precise that my nodes are statically positioned.

Normally when one changes the size of a node (for example by changing its scale), that will invalidate the layout responsible for positioning the node. That’s the case in the RegroupingScaled sample.

I suppose you have not set Group.layout in your app? Then you’ll need to move the nodes appropriately.

And I don’t think it makes sense to scale a link. But you could scale labels on a link.

I see, thank you.

Last question: is there in the existing examples a version of a function that would reposition the nodes after scaling ?

No, I cannot think of any existing samples that do precisely that. But it’s easy enough to implement a subclass of Layout that overrides doLayout to scale each node and locate them based on a simple calculation taking the scale and the node’s data’s nominal “location”.

http://gojs.net/latest/intro/extensions.html