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

Mix horizontal and vertical graph #68

Closed
lumenwrites opened this issue Dec 20, 2014 · 6 comments
Closed

Mix horizontal and vertical graph #68

lumenwrites opened this issue Dec 20, 2014 · 6 comments
Labels
Type: Other Not an enhancement or a bug

Comments

@lumenwrites
Copy link

Hi!
I am tying to make a graph like this:
linreg-graph
Is it possible?
And if not - is there some alternative way to do that?

P.S.
Thank you very much for a fantastic project!!

@knsv knsv added the Type: Other Not an enhancement or a bug label Dec 22, 2014
@knsv
Copy link
Collaborator

knsv commented Dec 22, 2014

Thanks for the kind words!

Unfortunately I cant think of a good way to do what you are trying to do.

@andrewfhart
Copy link

I am new to this project, and so haven't looked at the code in detail yet, but I was interested in doing something similar, and wondered if it might be possible to extend layout support (TD,LR, etc.) to subgraphs. If that could be done, then the above could be represented as:

graph TD
  ts(Training Set) --> la(Learning Algorithm)
  subgraph hypothesis LR
  sh(Size Of House) --> h(Hypothesis) --> ep(Estimated Price)
  end
  la --> h

The "LR" in the subgraph defininition would specify a horizontal left-to-right layout for subgraph elements, creating the inverted T structure desired above. Is this feasible to implement in the current architecture?

@knsv
Copy link
Collaborator

knsv commented Apr 7, 2015

Hello Andrew!

Subgraphs are actually supported with very similar syntax to the one you proposed.

The only difference is that in the current implementation the subgraphs inherit the layout from the main chart.

Chains are however not supported:
h(Size Of House) --> h(Hypothesis) --> ep(Estimated Price)

would take two rows:

h(Size Of House) --> h(Hypothesis)
h(Hypothesis) --> ep(Estimated Price)

so correct syntax for the subgraph would be:
subgraph hypothesis
sh(Size Of House) --> h(Hypothesis)
h(Hypothesis) --> ep(Estimated Price)
end

I hope this help!
/Knut

On Tuesday 7 April 2015 at 02:40, Andrew Hart wrote:

I am new to this project, and so haven't looked at the code in detail yet, but I was interested in doing something similar, and wondered if it might be possible to extend layout support (TD,LR, etc.) to subgraphs. If that could be done, then the above could be represented as:
graph TD ts(Training Set) --> lr(Learning Algorithm) subgraph hypothesis LR sh(Size Of House) --> h(Hypothesis) --> ep(Estimated Price) end lr --> h
The "LR" in the subgraph defininition would specify a horizontal left-to-right layout for subgraph elements, creating the inverted T structure desired above. Is this feasible to implement in the current architecture?


Reply to this email directly or view it on GitHub (#68 (comment)).

@knsv
Copy link
Collaborator

knsv commented Jun 7, 2015

I am going through issues and see this one as closed. Let me know if you feel differently.

@knsv knsv closed this as completed Jun 7, 2015
@ranjitc
Copy link

ranjitc commented Feb 18, 2018

hi @knsv fantastic project! (sorry just had to say that) ... i believe subgraphs still cannot have their own topology and inherit it from the parent. is this feature planned to be added? will add great flexibility to mermaid.

mgenereu referenced this issue in mgenereu/mermaid Jun 25, 2022
Add code formatting and precommit hook
@mjperrone
Copy link

@knsv I'd like to request that you post a fully working example for how to work around this limitation. This message wasn't very clear to me as someone with limited experience with mermaid. A link to a snippet displaying OP's desired graph would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Other Not an enhancement or a bug
Projects
None yet
Development

No branches or pull requests

5 participants