Comments (23)
Could you perhaps paste/provide your erd file here?
from erd.
@mmzx I see it even with the example sample.er
from erd.
@jonathan-chin , currently the text alignment is hard coded, that is, node specific alignment is not supported. You could e.g. do something like the following, which is only a partial solution - because globally applied for all nodes.
erd -i ./examples/simple.er -f dot | sed s/RIGHT/LEFT/g | dot -o"sample.pdf" -Tpdf
Results in:
from erd.
@mmzx I'm also curious because my keys and node titles don't get the same styling that you do (bold, underline, italics). Is it because of my OS? because I compiled it from Stack?
from erd.
@jonathan-chin , compiling it via stack or something else would not affect outcome.
If you would post your erd file and intermediate html (dot) we might understand more. I do not have access to osx, so looking at these intermediates could help.
from erd.
@mmzx here is my ERD file (it's the one from the repo; just including it for completeness sake)
# Entities are declared in '[' ... ']'. All attributes after the entity header
# up until the end of the file (or the next entity declaration) correspond
# to this entity.
[Person]
*name
height
weight
`birth date`
+birth_place_id
[`Birth Place`]
*id
`birth city`
'birth state'
"birth country"
# Each relationship must be between exactly two entities, which need not
# be distinct. Each entity in the relationship has exactly one of four
# possible cardinalities:
#
# Cardinality Syntax
# 0 or 1 ?
# exactly 1 1
# 0 or more *
# 1 or more +
Person *--1 `Birth Place`
here (I believe) is the dot file generated by erd -i ./simple.er -f dot > simple.dot
graph {
graph [rankdir=LR,
splines=spline
];
node [label="\N",
shape=plaintext
];
edge [color=gray50,
minlen=2,
style=dashed
];
Person [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">Person</FONT></B></TD></TR><TR><TD ALIGN="RIGHT"><U><FONT>name</FONT></U></TD></TR><TR><TD ALIGN="RIGHT"><FONT>height</FONT></TD></TR><TR><TD ALIGN="RIGHT"><FONT>weight</FONT></TD></TR><TR><TD ALIGN="RIGHT"><FONT>birth date</FONT></TD></TR><TR><TD ALIGN="RIGHT"><I><FONT>birth_place_id</FONT></I></TD></TR></TABLE></FONT>>];
"Birth Place" [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">Birth Place</FONT></B></TD></TR><TR><TD ALIGN="RIGHT"><U><FONT>id</FONT></U></TD></TR><TR><TD ALIGN="RIGHT"><FONT>birth city</FONT></TD></TR><TR><TD ALIGN="RIGHT"><FONT>birth state</FONT></TD></TR><TR><TD ALIGN="RIGHT"><FONT>birth country</FONT></TD></TR></TABLE></FONT>>];
Person -- "Birth Place" [headlabel=<<FONT>1</FONT>>,
taillabel=<<FONT>0..N</FONT>>];
}
from erd.
The dot file is correct, generated as it should be. So my assumption will be that it is your local setup that contributes to the differences.
What is your version of dot (dot -V)?
Maybe you could try other output format(s), e.g. svg, which can be checked in a web-browser.
from erd.
Thanks. I do notice that in the dot file, there's <TD ALIGN="RIGHT">
my dot version is dot - graphviz version 2.40.1 (20161225.0304)
I also just tried some other output formats (png, jpg, gif, svg, pdf) and it's the same. right aligned, no other styling on keys.
from erd.
-
The default is to generate right aligned text, that is what is shown in your generated erd file.
-
Currently it is not supported to change the alignment of the text by erd via command or by other means.
-
Would you want to change the alignment of the text, via the above suggested workaround (using sed) you shall be able to do that. It is to be expected to bring, provide you different output when applied correctly.
-
Your graphviz version is excellent.
Other than that, if all above fails I would say it has something to do with the local setup of yours.
Have you tried the above workaround with sed?
from erd.
@mmzx the above workaround works for left aligning but the primary and foreign keys are not being formatted. I noticed this in the README:
NB OSX users: for text formatting of keys (bold and italics) you may need to reinstall graphviz with pango support:
However, after doing what it suggested (brew install graphviz
), the keys are still not formatted. is the issue (alignment and formatting) with pango support?
from erd.
following up on this. I installed ERD on a new machine (completely different from previous). Now running Ubuntu 18.04LTS
color and styling work but everything is right aligned like before. this happens, again, with just the sample ERD file.
from erd.
Okay. I had some commits that were not pushed from recent days. It is now explicitly defined to align to the left, which is the default anyway.
Could you please check again? You would need to build erd
by cloning the master branch and building a binary.
git clone https://github.com/BurntSushi/erd.git
cd erd
stack build # or install
from erd.
thanks @mmzx ! my ubuntu system works perfectly now.
on osx, the text alignment is fixed but some of the other styling isn't showing through (underlining and italics primary / foreign keys). this is the example simple.er:
any idea why? it's not a dealbreaker; honestly, the text alignment was a deal breaker and I was just about to learn graphwiz myself, but now I think I'll stick with erd.
I'd love to help but I dived into the source code yesterday and realized I have no idea how Haskell works.
from erd.
Yeah, stick with erd! :P
I suspect these differences are related to local settings, which I think is inherently difficult to be prepared for. There is some work/idea in preparation to explicitly define more of these properties. In such situations we should compare output files. So, the resulted dot file is the following via the command erd -i simple.er -f dot
on my machine:
graph {
graph [rankdir=LR,
splines=spline
];
node [label="\N",
shape=plaintext
];
edge [color=gray50,
minlen=2,
style=dashed
];
Person [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">Person</FONT></B></TD></TR><TR><TD ALIGN="LEFT"><U><FONT>name</FONT></U></TD></TR><TR><TD ALIGN="LEFT"><FONT>height</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>weight</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>birth date</FONT></TD></TR><TR><TD ALIGN="LEFT"><I><FONT>birth_place_id</FONT></I></TD></TR></TABLE></FONT>>];
"Birth Place" [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">Birth Place</FONT></B></TD></TR><TR><TD ALIGN="LEFT"><U><FONT>id</FONT></U></TD></TR><TR><TD ALIGN="LEFT"><FONT>birth city</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>birth state</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>birth country</FONT></TD></TR></TABLE></FONT>>];
Person -- "Birth Place" [headlabel=<<FONT>1</FONT>>,
taillabel=<<FONT>0..N</FONT>>];
}
Interpreting the dot file goes beyond erd
itself. I will try to see whether I can find out more about it, but I myself can't reproduce the issue.
I am happy that your alignment issue is resolved then!
from erd.
here's what I get with the same command:
graph {
graph [rankdir=LR,
splines=spline
];
node [label="\N",
shape=plaintext
];
edge [color=gray50,
minlen=2,
style=dashed
];
Person [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">Person</FONT></B></TD></TR><TR><TD ALIGN="LEFT"><U><FONT>name</FONT></U></TD></TR><TR><TD ALIGN="LEFT"><FONT>height</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>weight</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>birth date</FONT></TD></TR><TR><TD ALIGN="LEFT"><I><FONT>birth_place_id</FONT></I></TD></TR></TABLE></FONT>>];
"Birth Place" [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">Birth Place</FONT></B></TD></TR><TR><TD ALIGN="LEFT"><U><FONT>id</FONT></U></TD></TR><TR><TD ALIGN="LEFT"><FONT>birth city</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>birth state</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>birth country</FONT></TD></TR></TABLE></FONT>>];
Person -- "Birth Place" [headlabel=<<FONT>1</FONT>>,
taillabel=<<FONT>0..N</FONT>>];
}
So our dot's are the same. What's the next step in processing?
from erd.
I have just done some searching in the hope there will be straightforward answer(s). I believe we are dealing with the same type of situation as described in [1].
The content of the dot file match up against the expected content: that's how far erd
itself can go; the rendered result may differ based on platform related differences.
My current recommendation for the short therm would be to stick with something that works as expected. Alternatively docker or the statically built version of erd
[2]. On the long-term, we would need to see whether this can be influenced and, first of all, to be reproduced.
In [2] now, there are binaries for 64bit systems statically and dynamically linked ones. I do understand that it would not solve osx related issues, but the static binary is there for the purpose to have something which behaves equally well.
from erd.
from erd.
If you could help finding out the dirty details that would be great at least to know the reasons to have an explanation.
from erd.
from erd.
I have created a ticket, hopefully we will gain some insights.
from erd.
@jonathan-chin , would you mind if you (we) continue the discussion on the gitlab ticket, specifically anything that is related to dot itself?
from erd.
Hell, yeah! Thank you!
I am going to update the readme based on the inputs you have kindly provided.
If you think all of your issues has been resolved, I would like to close this. Please let me know!
from erd.
from erd.
Related Issues (20)
- Updating CI config
- Enhancement: Publish image on Docker Hub
- Option to resize generated ERD, change aspect ratio HOT 3
- different ways of distributing the models on the diagram HOT 4
- Please delete
- Add support of regular dot tables as output, apart from html. HOT 4
- Include stylish-haskell in CI script. HOT 1
- Building haddock documentaion for hackage fails. HOT 1
- Creating an extensive test suite. HOT 2
- Making package ghc-8.8.1 compatible. HOT 1
- Vim support for the ER file format
- Build Error on WSL1 + Ubuntu 18.04 HOT 7
- Building docker image from scratch fails HOT 1
- ./build-static_by-nix.sh doesn't work HOT 1
- Add support for crow's foot notation HOT 1
- Make edges style (dashed/solid) customizable HOT 1
- Including NOT NULL, UNIQUE, types and comments in the syntax HOT 3
- Labels of ortho edges are misplaced
- Wrong png image of simple.er in the readme HOT 2
- Problem with non US-ASCII characters HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from erd.