0

How can I create some attributes to the node generated with DOT?

digraph{rankdir="TB";
node[shape=box];
0[label=<0<br/><i><b>Inspect the fridge</b></i><br/>Claw Hammer x1> tag="SpeakEasySwapFridgeDoorClosedF3" ID="0" status="off" data="[{'Item': 'Claw Hammer', 'Qty': 1}]"];
1[label=<1<br/><i><b>Unlock the Music Studio</b></i>> tag="MusicianRoomUnlock" ID="1" status="off" data="[]"];

The Label part work ok, get the italic and bold. But the generated result doesn't have the tag,ID, status or data attributes.

<g id="node1" class="node">
<title>0</title>
<polygon fill="none" stroke="#000000" points="367.4264,-7184 252.3724,-7184 252.3724,-7134 367.4264,-7134 367.4264,-7184"></polygon>
<text text-anchor="start" x="306.3994" y="-7168.4" font-family="Times,serif" font-size="14.00" fill="#000000">0</text>
<text text-anchor="start" x="260.9211" y="-7154.4" font-family="Times,serif" font-weight="bold" font-style="italic" font-size="14.00" fill="#000000">Inspect the fridge</text>
<text text-anchor="start" x="260.1364" y="-7140.4" font-family="Times,serif" font-size="14.00" fill="#000000">Claw Hammer x1</text>
</g>

1 Answer 1

0

The Graphviz programs do accept user-defined attributes as input, but only pass those attributes on if the output format is dot, canon, gv, or xdot.

You might investigate using Graphviz's comment attribute to insert your extra content into the SVG (as SVG comments), and postprocessing that.

Also, Graphviz does support the class attribute (see https://www.graphviz.org/docs/attrs/class/) for SVG output. Maybe you can use it - directly or via a postprocessor.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.