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

can't nest subgraphs in flowchart #161

Closed
masukomi opened this issue May 5, 2015 · 11 comments
Closed

can't nest subgraphs in flowchart #161

masukomi opened this issue May 5, 2015 · 11 comments

Comments

@masukomi
Copy link

masukomi commented May 5, 2015

The following is a valid subgraph

 graph TB
   subgraph Foo
     a1-->a2
   end

but this is not

 graph TB
   subgraph Foo
     a1-->a2
     subgraph Bar
       b1-->b2
     end
   end

I can't think of a reason subgraphs should not be nestable, and i can think of reasons I'd want them to be.

@knsv
Copy link
Collaborator

knsv commented May 6, 2015

I agree that they should be nestable. Adding it to the list. Heavily involed in another project right now so the change will when I manage to find time.

@knsv
Copy link
Collaborator

knsv commented May 15, 2015

The issue is fixed and will be included in next release.

@ubreddy
Copy link

ubreddy commented May 21, 2015

looks like the fix has some bugs.

nested subgraph labels at 3 or levels deep are not working well, or if there are two subgraphs within a subgraph too.

@knsv
Copy link
Collaborator

knsv commented May 21, 2015

Hmm. I wonder if there was a problem with the check in. This is my test page for nested subgraphs or perhaps this one is to simple.

skarmavbild 2015-05-21 kl 18 49 26

@ubreddy
Copy link

ubreddy commented May 22, 2015

Please notice the labels of subgraphs going haywire.

graph TB; I --> IG((IG))

subgraph publicnet
IG --> ELB
NAT
end
subgraph webnet
ELB --> Web1
ELB --> Web2
Web1 --> elb2
Web2 --> elb2
end
subgraph appnet
subgraph C1
subgraph C1cluster1
elb2 --> C1Prod1Ins1
elb2 --> C1Prod1InsN
end
subgraph C1cluster2
elb2 --> C1Prod2Ins1
elb2 --> C1Prod2InsN
end
subgraph C1cluster3
elb2 --> C1Prod3Ins1
elb2 --> C1Prod3InsN
end
end
subgraph C2
subgraph C2cluster1
elb2 --> C2Prod1Ins1
elb2 --> C2Prod1InsN
end
subgraph C2cluster2
elb2 --> C2Prod2Ins1
elb2 --> C2Prod2InsN
end
subgraph C2cluster3
elb2 --> C2Prod3Ins1
elb2 --> C2Prod3InsN
end
end
end
subgraph dbnet
C1Prod1Ins1 --> RDS1
C1Prod1InsN --> RDS1
C1Prod2Ins1 --> RDS1
C1Prod2InsN --> RDS1
C1Prod3Ins1 --> RDS1
C1Prod3InsN --> RDS1
C2Prod1Ins1 --> RDS2
C2Prod1InsN --> RDS2
C2Prod2Ins1 --> RDS2
C2Prod2InsN --> RDS2
C2Prod3Ins1 --> RDS2
C2Prod3InsN --> RDS2
end

test

@knsv
Copy link
Collaborator

knsv commented May 22, 2015

Thanks for your example. I can replicate the issue now.

@knsv
Copy link
Collaborator

knsv commented May 23, 2015

The issue was a bit harder ti fix then anticipated. The proper way to fix this involves a change in dagre-d3. I have submitted such a pull request and if/when this is included in dagre-d3 I will finish the solution of this issue.

The problem is to identify the area in svg that is a subgraph. The positioning engine dagre-d3 positions thins for a good layout that does not necessarily correspond to the order things are in the graph definition so it is a guessing game to find the right section.

knsv added a commit that referenced this issue May 28, 2015
@knsv
Copy link
Collaborator

knsv commented May 28, 2015

The change in dagre-d3 has been released and the fix of the issue with the crazy labels has been pushed into (dev-0.5.0). In that branch there are also some experimental changes for packaging mermaid and for integration so use with care. Look at test/web_render.html for an example of nested subgraphs.

@knsv
Copy link
Collaborator

knsv commented Jun 7, 2015

A fix for this has been released in version 0.5.0

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

ubreddy commented Jun 9, 2015

@knut
Replaced mermaid.full.js of 0.4 with mermaid.js of version 0.5 and the diagrams dont render? read the docs... It should have worked. 
What am I missing? any guidance?
Regards Uday

 On Sunday, 7 June 2015 9:04 PM, Knut Sveidqvist <notifications@github.com> wrote:

A fix for this has been released in version 0.5.0—
Reply to this email directly or view it on GitHub.

@knsv
Copy link
Collaborator

knsv commented Jun 9, 2015

Thanks for pointing this out. You also need to add the code below to your page. I will update the docs.

<script>mermaid.initialize({startOnLoad:true});</script>

Knut Sveidqvist
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Tuesday 9 June 2015 at 06:28, Udaya Reddy wrote:

@knut
Replaced mermaid.full.js of 0.4 with mermaid.js of version 0.5 and the diagrams dont render? read the docs... It should have worked.
What am I missing? any guidance?
Regards Uday

On Sunday, 7 June 2015 9:04 PM, Knut Sveidqvist <notifications@github.com (mailto:notifications@github.com)> wrote:

A fix for this has been released in version 0.5.0—
Reply to this email directly or view it on GitHub.


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

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

No branches or pull requests

3 participants