diagram-plugin
diagram-plugin copied to clipboard
[enhancement] Better layout algorithm
There was this another issue in the previous version (which I have previously installed) where the line was overlapped by table.
Maybe it might have been fixed in the newer version.
Originally posted by @mittalyashu in https://github.com/TablePlus/diagram-plugin/issues/5#issuecomment-714471708
At the moment we choose to place the Tables over the References.
As far I understand the canvas (well, I don't even know how this plugin is build) has infinite space so just push the table bit further away so that the references doesn't over lap the tables.
And I mean by the above image.
NOTE: The above image was taken after the table arrangement was done by plugin automatically, I didn't change their positions.
![]()
Not this 👆
Originally posted by @mittalyashu in https://github.com/TablePlus/diagram-plugin/issues/5#issuecomment-714892046
As far I understand the canvas (well, I don't even know how this plugin is build) has infinite space so just push the table bit further away so that the references doesn't over lap the tables.
This is a very reasonable approach :D Unfortunately our current "layout" algorithm is not quite as good. Let us improve it. You are right that the layout should put the tables to minimize the overlaps
Originally posted by @dvkndn in https://github.com/TablePlus/diagram-plugin/issues/5#issuecomment-714893168
@dvkndn That's not really an infinite canvas, it only expands to X+ and Y+ axis
Yes :( The fact that it is not an infinite canvas is causing many issues now. Basically we need to make it infinite first (or just that it's really really big)
Another layout issue: When plotting huge databases we might get connected tables on opposite ends of the layout. Is there a way to find better layouts? I used different layout algorithms when facing the same issue using NetworkX , I would be happy to do a MR for this if you can give me some guidance as to where / how the current calculations are done
oh great @migueltorrescosta !
Is there a way to find better layouts?
We are looking into this. But the biggest issue is that we need to support the infinite canvas first. It would make all of these things much easier. To be specific, the (0, 0) should be the center, not at top left like this
I would be happy to do a MR for this if you can give me some guidance as to where / how the current calculations are done
Unfortunately at the moment the original source code is not completely open :(
I understand. If there's anything I could do to speed up the process do ask, it would make the generator that much more valuable :)
I'd also appreciate an improved layout algorithm. I wonder if it's possible to reduce the number of line crossings (as much as possible). For example GraphViz (https://www.graphviz.org) does it, other libraries can surely do it as well. (I only mention this one, because I'm comfortable with it.)
This super simple example shows what I mean:

The connections line_items ➙ orders
and line_items ➙ carts
cross each other, even though it's (topologically) not necessary.