图表制作工具:如何在Mermaid连接符上添加标签

8

我正在尝试使用R DiagrammeR库,但是无法为盒子之间的连接器添加标签...... 我的代码(运行正常)如下:

library(DiagrammeR)
mermaid("
graph TD
        A[node 1]-->B[node 2]
        A-->C[node 3]
        C-->E[another node]
        B-->D[node 4]
        ")

使用相同库的函数grViz,可以添加标签,例如:
 A[label:'This is the NO path"]

但是这种方式在mermaid函数中会出现错误... 我尝试了:

 A[node 1]-->B[node 2][label="test"]
 A[node 1]-->B[node 2, label="test"]

其他人都没有成功。

我想要类似这个图表的东西,并在连接中添加“是”的内容。 enter image description here

有什么想法吗?提前感谢!

1个回答

13

A-->C[node 3] 之间添加|Yes|


library(DiagrammeR)
mermaid("
graph TD
        A[node 1]--> B[node 2]
        A-->|Yes| C[node 3]
        C-->E[another node]
        B-->D[node 4]
        ")

enter image description here


能否将节点1和节点3之间的线路变为双向的? - Gavin Hill

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接