mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-02 15:16:49 +02:00
Resolved issue with subgraph configuration
This commit resolves the issues with subgraph configuration, specifically for nodeSpacing and rankSpacing. This commit additionally adds an example graph to the `flowchart.html` to demonstrate this resolution. This commit resolves #3258
This commit is contained in:
@@ -1540,6 +1540,30 @@
|
|||||||
</pre>
|
</pre>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
|
<pre class="mermaid">
|
||||||
|
---
|
||||||
|
title: Subgraph nodeSpacing and rankSpacing example
|
||||||
|
---
|
||||||
|
%%{init:{'flowchart':{'nodeSpacing': 1, 'rankSpacing':'1'}}}%%
|
||||||
|
|
||||||
|
flowchart LR
|
||||||
|
|
||||||
|
X --> Y
|
||||||
|
|
||||||
|
subgraph X
|
||||||
|
direction LR
|
||||||
|
A
|
||||||
|
C
|
||||||
|
end
|
||||||
|
|
||||||
|
subgraph Y
|
||||||
|
direction LR
|
||||||
|
B
|
||||||
|
D
|
||||||
|
end
|
||||||
|
</pre>
|
||||||
|
<hr />
|
||||||
|
|
||||||
<h1 id="link-clicked">Anchor for "link-clicked" test</h1>
|
<h1 id="link-clicked">Anchor for "link-clicked" test</h1>
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
|
@@ -54,6 +54,10 @@ const recursiveRender = async (_elem, graph, diagramtype, id, parentCluster, sit
|
|||||||
if (node && node.clusterNode) {
|
if (node && node.clusterNode) {
|
||||||
// const children = graph.children(v);
|
// const children = graph.children(v);
|
||||||
log.info('Cluster identified', v, node.width, graph.node(v));
|
log.info('Cluster identified', v, node.width, graph.node(v));
|
||||||
|
// node.graph.setGraph applies the graph configurations such as nodeSpacing to subgraphs as without this the default values would be used
|
||||||
|
node.graph.setGraph(graph.graph()).setDefaultEdgeLabel(function () {
|
||||||
|
return {};
|
||||||
|
});
|
||||||
const o = await recursiveRender(
|
const o = await recursiveRender(
|
||||||
nodes,
|
nodes,
|
||||||
node.graph,
|
node.graph,
|
||||||
|
Reference in New Issue
Block a user