Blazor-Diagrams / Blazor.Diagrams

A fully customizable and extensible all-purpose diagrams library for Blazor
https://blazor-diagrams.zhaytam.com
MIT License
921 stars 177 forks source link

[Question] Algoritm to position nodes / layout diagram? #195

Closed RonSijm closed 2 years ago

RonSijm commented 2 years ago

Hey there, not an issue, just a question of "How do I do this?" -

My use-case is that I want to display a diagram of nodes connected to each other. For an easy reference, imagine the DatabaseDesigner: https://github.com/Blazor-Diagrams/Blazor.DatabaseDesigner

What I want to do is - from code, iterate over a model, lets say a database model. Then programmatically add all the needed tables and connections to the diagram, and then call a function to place these tables in a position in the diagram so that their position relative to each other makes sense, and it'll give a decent overview of tables and their connections to each other.

For reference, something like the enterprise architect function of "layout diagram": https://sparxsystems.com/enterprise_architect_user_guide/15.2/modeling/layoutadiagram.html

I was considering to build something to do this, but was just wondering if there was already anything out there so that I don't have to build it myself

zHaytam commented 2 years ago

Hello, You'll need to implement a layout algorithm or use a library that can do itfor you. Examples: https://github.com/Blazor-Diagrams/Blazor.Diagrams/tree/master/docs/Layouts (GraphShape library)

RonSijm commented 2 years ago

Oh ok, thanks. I didn't know it was already possible out-of-the-box.

I was checking https://blazor-diagrams.zhaytam.com/demos/simple to see the possible features, and I don't think that the "Layout diagram" demos are in there.

But I've cloned this repo, and it looks like close to what I need, yea, thanks