Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re: Location of nodes, edges in Network Monitoring Demo #16

Closed
kimiyoshi opened this issue Jan 12, 2023 · 1 comment
Closed

Re: Location of nodes, edges in Network Monitoring Demo #16

kimiyoshi opened this issue Jan 12, 2023 · 1 comment
Labels

Comments

@kimiyoshi
Copy link

kimiyoshi commented Jan 12, 2023

In network monitoring demo,
location(x,y) of nodes, edges are given by hardcoding in network-sample.ts

Is there any way to auto-calculate for location(x,y)?

Currently I am considering to feed network(nodes,edges) from database, and wondering how to give x,y.

Thanks for your help.

P.S. FYI, I am a licensed user.

@yGuy
Copy link
Member

yGuy commented Jan 12, 2023

Yes, of course there is a way to do this automatically. In fact the only reason this hasn't been done in this demo is because at that time we were creating demos that should also work with a package that does not use the automatic layouts.
But indeed, you can use the OrganicLayout algorithm to compute these values/the layout of the diagram after loading your graph from the database. This is also what we did when we created the demo originally.

So right after you have loaded your data, you can do graphComponent.graph.applyLayout(new OrganicLayout()) or graphComponent.morphLayout(new OrganicLayout()) to get a nice initial layout, automatically.

Note that as a user of the library, you can/should use the support backend at https://my.yworks.com to ask for help. This will get you faster and more accurate responses. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants