0

I'm trying to create a state chart from Graphviz of type record. Please check the reference here.

So here is the basic code:

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|"]
}

In above code, I need to add some code below the state name like On and Off where I put the line Some code here. Since there will be a code and it can be any number of lines, I like to change the font size of this single record block where I will put the code (Not the state name record).

So in this line of code:

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

I like to change the font size of Some code here only not of On.

So, How can I get the control to independently change styling like font size or font name etc of the entered code here?

qwerty_so
  • 35,448
  • 8
  • 62
  • 86

1 Answers1

3

You can use html-like text, without building tables. (https://www.graphviz.org/doc/info/shapes.html#html). Like so:

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|  "]
}

Giving:
enter image description here

sroush
  • 5,375
  • 2
  • 5
  • 11
  • Hi @sroush, thanks for the answer. Facing one more issue regarding graphviz. Hope you can help with this one too https://stackoverflow.com/questions/68953216/hierarchical-state-machine-with-graphviz – Gaurav Saxena Aug 27 '21 at 12:19