- Home
- Forum
- Angular - EJ 2
- Center all nodes inside diagram, center on selected nodes, and programatically select node
Center all nodes inside diagram, center on selected nodes, and programatically select node
Hello,
- I am creating a diagram (nodes/connectors/annotations) programmatically (through .ts) and want to be able to center those nodes inside the diagram bounds. As I don't know how many nodes ahead of time, this would need to happen at run time. Is there a way to make all the added nodes fit within the bounds of the diagram (which is also dynamic in the sense that it has a percentage width rather than a hard coded pixel value).
- Along with the above, is there a way to center/zoom to a selected node?
- And finally, how to select a node programmatically?
Thanks!
SIGN IN To post a reply.
1 Reply
AR
Aravind Ravi
Syncfusion Team
May 21, 2020 07:34 AM UTC
Hi Benjamin,
Please find the response for queries in below table
|
I am creating a diagram (nodes/connectors/annotations) programmatically (through .ts) and want to be able to center those nodes inside the diagram bounds. As I don't know how many nodes ahead of time, this would need to happen at run time. Is there a way to make all the added nodes fit within the bounds of the diagram (which is also dynamic in the sense that it has a percentage width rather than a hard coded pixel value). |
By using the scroll settings we can able to get the diagram viewport width. So by using view port width we can set offsetx for the node. So it looks like node gets renders in the center of the diagram bounds.
| |
|
Along with the above, is there a way to center/zoom to a selected node?
|
By default, in the diagram we can able to zoom in or zoom out the diagram. We does not able to zoom the particular node in diagram. Please find the below code snippet for how to zoom in or zoom out the diagram.
| |
|
And finally, how to select a node programmatically?
|
By using diagram public API method select we can able to select a particular node in the diagram programmatically.
|
We have created a KB to add nodes without overlapping each other. Please refer to below KB
Regards
Aravind Ravi
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
-
BD Benjamin Davenport
- May 20, 2020 04:40 PM UTC
- May 21, 2020 07:34 AM UTC