BurntSushi / erd

Translates a plain text description of a relational database schema to a graphical entity-relationship diagram.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Option to resize generated ERD, change aspect ratio

Baerbeisser opened this issue · 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?

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:

graphAttrs [ A.RankDir A.FromLeft
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 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...

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.