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

Multiple graph in the live editor #586

Closed
salarmehr opened this issue Oct 17, 2017 · 11 comments
Closed

Multiple graph in the live editor #586

salarmehr opened this issue Oct 17, 2017 · 11 comments

Comments

@salarmehr
Copy link

Can we have multiple independent graph in the same live editor? This does not work:

graph LR
 unpaid-->paid[paid/unassigned]
 paid-->assigned
 assigned==>finished
assigned-->withdrew
assigned-->cancelled


subgraph LR 
test-->foo

@erikh2000
Copy link

It was necessary for me to add "end" on the last line to close the subgraph declaration. But other than that, your code above works for me.

I'm unclear what you mean by in the "same live editor".

@salarmehr
Copy link
Author

@erikh2000 Yes it works with adding end!.
Thanks for you awesome graphing syntax.

@salarmehr salarmehr reopened this Oct 31, 2017
@salarmehr
Copy link
Author

Oh sorry, it does not work indeed.


graph TB
    c1-->a2
    subgraph one
    a1-->a2
    end
    subgraph two
    b1-->b2
    end
    subgraph three
    a1-->c2
    end

in the above code we have a1 node in the first and last subgrph and they are independent node, however there is inter-graph links to them. I a link is not defined in the top graph section of syntax in there should be no intergraph link.

@salarmehr
Copy link
Author

My issue is mainly about adding multiple independent graphs in the live editor that can be achieved by allowing multiple graph statement in it.

@erikh2000
Copy link

You need to give unique names to your nodes so that Mermaid won't interpret them as the same node. It makes sense if you think about it. How would Mermaid know if you meant the two "a1" nodes to be separate?

So for example, you can change one of the "a1"s to "a1_copy". That gives you an ugly "a1_copy" text rendered in the graph, but you can specify a separate label like so:

a1_copy[a1]-->c2

...and then the node will render in the graph with "a1" text.

@salarmehr
Copy link
Author

salarmehr commented Oct 31, 2017

That is exactly the issue. My point is allowing multiple separate set of node in tow graph statement.

graph TB
...
graph TB
...

@salarmehr
Copy link
Author

also two having independent node with the same name among subgraph we can use subgraph name as name space
in above example:

graph TB
    one.a1-->three.a1
    subgraph one
    a1-->a2
    end
    subgraph two
    b1-->b2
    end
    subgraph three
    a1-->c2
    end  

@tylerlong
Copy link
Collaborator

It is doable in your own HTML page. Just put your code in two separate <div class="mermaid"></div>.

But for https://mermaidjs.github.io/mermaid-live-editor/, I don't think we will add this feature since this is not a common use case.

@xumxum
Copy link

xumxum commented Apr 11, 2019

I would need the same, multiple graphs ...

@dennisvandenende
Copy link

dennisvandenende commented Nov 5, 2019

tylerlong write it is not common use. But i disagree. For example to create a subflow as a sidestep.
As it is now it will be one long row to the left or bottom.
But a flow to the left van have a sidestep down.

For example something like this:

graph LR
    one.a1-->three.a1
    subgraph one
    a1-->a2
    end
    subgraph two
    b1-->b2
    end
graph BR
    subgraph three
    b2-->d1
    d1-->d2
    end  
graph LR
    subgraph Four
    a1-->c2
    end  

@IOrlandoni
Copy link
Member

Hey, you're commenting on a closed issue. Feel free to open a new issue if the problem still persists.

@mermaid-js mermaid-js locked as resolved and limited conversation to collaborators Nov 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants