graphviz 中跨越多行的记录

发布于 2024-09-26 01:06:05 字数 891 浏览 8 评论 0原文

我试图用点语言可视化一个相当复杂的结构。 因为记录很大,所以我想把代码写成多行。因此,而不是:

A11[label="A.11 Access Control|{A.11.1 Business requirements for access control|A.11.2 User access management}|{A.11.3 User responsibilities|A.11.4 Network access control}|{A.11.5 Operating System access control|A.11.6 Application & information access control}|A.11.7 Mobile computing & teleworking"];

我想像这样输入它

A11[label="A.11 Access Control|
           {A.11.1 Business requirements for access control|A.11.2 User access management}|
           {A.11.3 User responsibilities|A.11.4 Network access control}|
           {A.11.5 Operating System access control|A.11.6 Application & information access control}|
           A.11.7 Mobile computing & teleworking"];

不幸的是,点的解析器抱怨“字符串运行超过行尾”或类似的东西。有谁知道如何在代码中表示换行符?我在行尾尝试了 \ ,但似乎不起作用。

提前致谢

I am trying to visualize a rather complex structure in the dot language.
Because the record is big, I would like to write the code in mulitple lines. So instead of:

A11[label="A.11 Access Control|{A.11.1 Business requirements for access control|A.11.2 User access management}|{A.11.3 User responsibilities|A.11.4 Network access control}|{A.11.5 Operating System access control|A.11.6 Application & information access control}|A.11.7 Mobile computing & teleworking"];

I would like to enter it somewhat like this

A11[label="A.11 Access Control|
           {A.11.1 Business requirements for access control|A.11.2 User access management}|
           {A.11.3 User responsibilities|A.11.4 Network access control}|
           {A.11.5 Operating System access control|A.11.6 Application & information access control}|
           A.11.7 Mobile computing & teleworking"];

Unfortunately the parser for dot complains about a "string running past line end" or something alike. Does anyone know how to denote a linebreak in the code? I tried a \ at the end of the line, but it didn't seem to work.

thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

栖迟 2024-10-03 01:06:05

我猜你想要这样的东西:

graph G{
A11[label="A.11 Access Control|\n\
{A.11.1 Business requirements for access control|A.11.2 User access management}|\n\
{A.11.3 User responsibilities|A.11.4 Network access control}|\n\
{A.11.5 Operating System access control|A.11.6 Application & information access control}|\n\
A.11.7 Mobile computing & teleworking"];
}

你也可以这样做

label = "line1\n" +
        "line2\n" + ...

I am guessing you want something like this:

graph G{
A11[label="A.11 Access Control|\n\
{A.11.1 Business requirements for access control|A.11.2 User access management}|\n\
{A.11.3 User responsibilities|A.11.4 Network access control}|\n\
{A.11.5 Operating System access control|A.11.6 Application & information access control}|\n\
A.11.7 Mobile computing & teleworking"];
}

You can also do like

label = "line1\n" +
        "line2\n" + ...
在巴黎塔顶看东京樱花 2024-10-03 01:06:05

使用 \ 转义换行符而不终止字符串。请注意,您可以在每个 {} 之前插入空格以缩进源代码中的行。该空白对生成的图形没有影响。

graph G{
    node [shape=record];
    A11[label="A.11 Access Control|\
        {A.11.1 Business requirements for access control|A.11.2 User access management}|\
        {A.11.3 User responsibilities|A.11.4 Network access control}|\
        {A.11.5 Operating System access control|A.11.6 Application & information access control}|\
        A.11.7 Mobile computing & teleworking"
    ];
}

演示 此处

Use \ to escape newlines without terminating the string. Note that you can insert whitespace before each {} to indent the lines in the source code. This whitespace has no effect on the generated graph.

graph G{
    node [shape=record];
    A11[label="A.11 Access Control|\
        {A.11.1 Business requirements for access control|A.11.2 User access management}|\
        {A.11.3 User responsibilities|A.11.4 Network access control}|\
        {A.11.5 Operating System access control|A.11.6 Application & information access control}|\
        A.11.7 Mobile computing & teleworking"
    ];
}

Demo here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文