【问题标题】:How to change font size of a single record item in Graphviz如何在 Graphviz 中更改单个记录项的字体大小
【发布时间】:2021-10-23 19:21:12
【问题描述】:

我正在尝试从记录类型的 Graphviz 创建状态图。请查看参考here。

下面是基本代码:

digraph lamp {
  node [shape=point,label=""]ENTRY
  node [style=rounded shape=record ]

  ON [label="{On| Some code here}"];
  OFF [label="{Off| Some code here}"];

  ENTRY -> ON[label="Initialization"]
  ON -> OFF[label="|toggle|"]
  OFF -> ON[label="|toggle|"]
}

在上面的代码中,我需要在状态名称下方添加一些代码,例如 On 和 Off 我把行 Some code here .由于会有一个代码并且它可以是任意数量的行,所以我喜欢更改这个单记录块的字体大小,我将在其中放置代码(不是州名记录)。

所以在这行代码中:

ON [label="{On| 这里有一些代码}"];

我喜欢改变Some code here的字体大小,只是On的不一样。

那么,如何让控件独立更改此处输入代码的字体大小或字体名称等样式?

【问题讨论】:

    标签: graphviz statechart


    【解决方案1】:

    您可以使用类似 html 的文本,而无需构建表格。 (https://www.graphviz.org/doc/info/shapes.html#html)。像这样:

    digraph lamp {
      node [shape=point,label=""]ENTRY
      node [style=rounded shape=record ]
    
      ON [label=<{<FONT COLOR="RED" POINT-SIZE="24.0">On</FONT>|<FONT COLOR="darkgreen" POINT-SIZE="10.0"> Some code here</FONT>}>];
      OFF [label=<{<FONT COLOR="black" POINT-SIZE="24.0">Off</FONT>|<FONT COLOR="darkred" POINT-SIZE="10.0"> Some code here</FONT>}>];
    
      ENTRY -> ON[label="Initialization"]
      ON -> OFF[label="  |toggle|  "]
      OFF -> ON[label="  |toggle|  "]
    }
    

    捐赠:

    【讨论】:

    猜你喜欢
    • 2010-12-28
    • 2011-10-28
    • 1970-01-01
    • 2015-08-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-16
    • 2021-10-08
    相关资源
    最近更新 更多