erd icon indicating copy to clipboard operation
erd copied to clipboard

Option to resize generated ERD, change aspect ratio

Open Baerbeisser opened this issue 3 years ago • 3 comments

Problem: the font of an ERD with 2nd level relations ([main]--[2]--[3]) is barely readable in a presentation, but fills only the upper half of the display. Too wide, too less height.

I tried to set the font to a bigger size, hoping Erd would reorder the tables but:

  • Changing it on some tables only, the changed tables look the same, all other smaller.
  • Changing it on all tables, everything loooks the same as before (bigger font but scaled down, still same layout).

Is there some way to tell Erd to generate images with different size/aspcet ratio, reordering the tables accordingly?

Baerbeisser avatar Jun 03 '21 14:06 Baerbeisser

I'd try to generate dot files using erd, then tweak them manually and run through Graphviz.

Some of the options that tell Graphviz how to layout the diagram are hardcoded in erd, and many of them are inacessible through erd's interface. If you don't mind that, you can tweak the code and recompile. You may for example try to remove A.RankDir A.FromLeft here: https://github.com/BurntSushi/erd/blob/d52f12e146cff816adf5329c25cf514a2eb970f1/app/Main.hs#L48 It worked for me with some more complex diagrams.


@mmzx @BurntSushi Maybe the user should be given the possibility to provide arbitrary graphviz attributes? I think this can be achieved without much cost using the UnknownAttribute constructor. The syntax could be e.g.

{ custom_graphviz-property-name: graphviz-property-value }

We don't validate this and just assume that the users know what they are doing.

I believe this could radically improve the usability without much implementation and maintenance cost.

kukimik avatar Jun 19 '21 14:06 kukimik

@kukimik I like the idea of custom properties, as long it would not introduce additional complexity regarding the configuration and consistency with existing switches. I am wondering...

mmzx avatar Jul 02 '21 15:07 mmzx

I was wrong. Using UnknownAttribute is not a good idea. Although this could work, the grapviz library docs forbid using the UnknownAttribute constructor for this. See the docs and sources of validUnknown.

kukimik avatar Aug 30 '21 13:08 kukimik