Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draw arrows between columns? #4

Open
krlmlr opened this issue Dec 16, 2017 · 11 comments
Open

Draw arrows between columns? #4

krlmlr opened this issue Dec 16, 2017 · 11 comments
Assignees

Comments

@krlmlr
Copy link
Contributor

krlmlr commented Dec 16, 2017

Thanks for the very helpful package!

I wonder if the columns of a table could be modeled as a subgraph inside the table nodes. This would allow linking the columns directly, we wouldn't need the ~ anymore.

@bergant
Copy link
Owner

bergant commented Dec 16, 2017

It is possible to use PORT attribute in graphviz HTML table. The result would be as shown in example below. Maybe I can support this kind of rendering as an option, since more complex diagrams may get messy...

image

@bergant bergant self-assigned this Dec 16, 2017
@krlmlr
Copy link
Contributor Author

krlmlr commented Dec 16, 2017

Thanks. Can you also link the arrow pointers to a column (e.g., to "Order ID" instead of the "Order" node)?

@bergant
Copy link
Owner

bergant commented Dec 16, 2017

Yes

image

@krlmlr
Copy link
Contributor Author

krlmlr commented Dec 16, 2017

Oh, that looks really good! Looking forward to it ;-)

bergant added a commit that referenced this issue Dec 16, 2017
@bergant
Copy link
Owner

bergant commented Dec 16, 2017

Here is the first attempt ...

Use columnArrows = TRUE when calling dm_create_graph.

@krlmlr
Copy link
Contributor Author

krlmlr commented Dec 17, 2017

Thanks. This looks slightly odd with rankdir = "LR", but I still like it: https://github.com/r-prof/profile/blob/24ab0ba316ea545fb06f1323ff597c16f97ef552/man/figures/dm.png

Can you specify more than one PORT attribute for a column, so that graphviz can choose what it thinks looks best?

@bergant
Copy link
Owner

bergant commented Dec 17, 2017

I think that only the first PORT is then taken into account. Linking from both side will only work if there is only one cell in a row (in your example - without the type column).

BTW, if you want to try something directly with graphviz, there is always a graphviz source in the graph$dot_code element.

@krlmlr
Copy link
Contributor Author

krlmlr commented Dec 18, 2017

Thanks. The dot source is useful for fine-tuning, but it would be great if this worked also for autogenerated diagrams.

I guess we still can squeeze all columns in a row into one, what other column types do you support?

@hswerdfe
Copy link

hswerdfe commented Mar 2, 2021

I am very late to the discussion, but to expand on @krlmlr comment about looking funny with rankdir = "LR" this is what my DB looks like when rendered columnArrows = TRUE it is a definite improvement, but there are sometimes strange effects where the arrow moves to the top right of the table then to the correct location.

image

thanks for all your work on the @bergant its a great package.

@krlmlr
Copy link
Contributor Author

krlmlr commented Mar 2, 2021

Thanks for the follow-up. Have you seen the new dm package? Unfortunately it will probably suffer from the same problem, because diagram drawing is inherited from here 🙃

@hswerdfe
Copy link

hswerdfe commented Mar 2, 2021

@krlmlr I have not seen dm I assume you mean this, I'll look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants