wolffd@0: wolffd@0: wolffd@0: wolffd@0:
wolffd@0:wolffd@0: | wolffd@0: | wolffd@0: | wolffd@0: |
box wolffd@0: | polygon wolffd@0: | ellipse wolffd@0: | circle wolffd@0: |
wolffd@0: | wolffd@0: | wolffd@0: | wolffd@0: |
point wolffd@0: | egg wolffd@0: | triangle wolffd@0: | plaintext wolffd@0: |
wolffd@0: | wolffd@0: | wolffd@0: | wolffd@0: |
diamond wolffd@0: | trapezium wolffd@0: | parallelogram wolffd@0: | house wolffd@0: |
wolffd@0: | wolffd@0: | wolffd@0: | wolffd@0: |
pentagon wolffd@0: | hexagon wolffd@0: | septagon wolffd@0: | octagon wolffd@0: |
wolffd@0: | wolffd@0: | wolffd@0: | wolffd@0: |
doublecircle wolffd@0: | doubleoctagon wolffd@0: | tripleoctagon wolffd@0: | invtriangle wolffd@0: |
wolffd@0: | wolffd@0: | wolffd@0: | wolffd@0: |
invtrapezium wolffd@0: | invhouse wolffd@0: | Mdiamond wolffd@0: | Msquare wolffd@0: |
wolffd@0: | wolffd@0: | wolffd@0: | wolffd@0: |
Mcircle wolffd@0: | rect wolffd@0: | rectangle wolffd@0: | none wolffd@0: |
wolffd@0: | wolffd@0: | wolffd@0: | wolffd@0: |
note wolffd@0: | tab wolffd@0: | folder wolffd@0: | box3d wolffd@0: |
wolffd@0: | |||
component wolffd@0: |
wolffd@0: The geometries of polygon-based shapes are also affected wolffd@0: by the node attributes wolffd@0: regular, wolffd@0: peripheries and wolffd@0: orientation. wolffd@0: If shape="polygon", the attributes wolffd@0: sides, wolffd@0: skew and wolffd@0: distortion are also used. wolffd@0: If unset, they default to 4, 0.0 and 0.0, respectively. wolffd@0: In addition, the 3 M* shapes support auxiliary labels using wolffd@0: the toplabel and wolffd@0: bottomlabel attributes. wolffd@0: On the other hand, the point shape is special in that it is wolffd@0: only affected by the peripheries, wolffd@0: width and wolffd@0: height attributes. wolffd@0: wolffd@0:
rlabel | = | field ( '|' field )* |
where field | = | fieldId or '{' rlabel '}' |
and fieldId | = | [ '<' string '>'] [ string ] |
wolffd@0: The first string in fieldId assigns a portname to the field and can wolffd@0: be combined with the node name to indicate where to attach an edge wolffd@0: to the node. (See portPos.) wolffd@0: The second string is used as the text for the field; it supports the usual wolffd@0: escape sequences \n, \l and \r. wolffd@0:
wolffd@0: Visually, a record is a box, with fields represented by alternating wolffd@0: rows of horizontal or vertical subboxes. The Mrecord shape is identical wolffd@0: to a record shape, except that the outermost box has rounded corners. wolffd@0: Flipping between horizontal and vertical layouts is done by nesting wolffd@0: fields in braces "{...}". The top-level orientation in a record is wolffd@0: horizontal. Thus, a record with label "A | B | C | D" will have 4 fields wolffd@0: oriented left to right, while "{A | B | C | D}" will have them wolffd@0: from top to bottom and "A | { B | C } | D" will have "B" over "C", with wolffd@0: "A" to the left and "D" to the right of "B" and "C". wolffd@0:
wolffd@0: The initial orientation of a record node depends on the wolffd@0: rankdir attribute. If this attribute wolffd@0: is TB (the default) or TB, corresponding to vertical wolffd@0: layouts, the top-level fields in a record are displayed horizontally. wolffd@0: If, however, this attribute is LR or RL, wolffd@0: corresponding to horizontal layouts, the top-level fields are wolffd@0: displayed vertically. wolffd@0:
wolffd@0: As an example of a record node, the dot input wolffd@0:
wolffd@0: If we add the line wolffd@0:
wolffd@0: If we change node struct1 to have shape Mrecord,
wolffd@0: it then looks like:
wolffd@0:
wolffd@0:
wolffd@0:
wolffd@0: Thus, the code wolffd@0:
wolffd@0: As an example of rounding, dot uses the graph wolffd@0:
wolffd@0: Additional styles may be available with a specific code generator. wolffd@0:
wolffd@0: If the value of a label attribute wolffd@0: (label for nodes, edges, clusters, and wolffd@0: graphs, and the wolffd@0: headlabel and wolffd@0: taillabel wolffd@0: attributes of an edge) is given as an wolffd@0: HTML string, wolffd@0: that is, delimited by <...> wolffd@0: rather than "...", wolffd@0: the label is interpreted as wolffd@0: an HTML description. At their simplest, such labels wolffd@0: can describe multiple lines of variously aligned text as provided by ordinary wolffd@0: string labels. More generally, the wolffd@0: label can specify a table similar to those provided by HTML, wolffd@0: with different graphical attributes at each level. wolffd@0:
wolffd@0: NOTE: The features and syntax supported by these labels are wolffd@0: modeled on HTML. However, there are many aspects that are relevant wolffd@0: to Graphviz labels that are not in HTML and, conversely, HTML allows wolffd@0: various constructs which are meaningless in Graphviz. We will generally wolffd@0: refer to these labels as "HTML labels" rather than the cumbersome wolffd@0: "HTML-like labels" but the reader is warned that these are not really wolffd@0: HTML. The grammar below describes precisely what Graphviz will accept. wolffd@0:
wolffd@0: Although HTML labels are not, strictly speaking, a shape, they can be wolffd@0: viewed as a generalization of the record shapes described above. wolffd@0: In particular, if a node has set its wolffd@0: shape wolffd@0: attribute to plaintext, the HTML label will be the node's wolffd@0: shape. On the other hand, if the node has any other shape (except wolffd@0: point), the HTML label will be embedded within the node the wolffd@0: same way an ordinary label would be. wolffd@0:
wolffd@0: The following is an abstract grammar for HTML labels. wolffd@0: Terminals, corresponding to elements, are shown in bold font, wolffd@0: and nonterminals in italics. wolffd@0: Square brackets [ and ] enclose optional items. wolffd@0: Vertical bars | separate alternatives. wolffd@0: Note that, as in HTML, element and attribute names are case-insensitive. wolffd@0: (cf. sections 3.2.1 and 3.2.2 of the wolffd@0: HTML 4.01 specification). wolffd@0:
label | wolffd@0:: | wolffd@0:text | wolffd@0:
wolffd@0: | | | wolffd@0:table | wolffd@0:
text | wolffd@0:: | wolffd@0:textitem | wolffd@0:
wolffd@0: | | | wolffd@0:text textitem | wolffd@0:
textitem | wolffd@0:: | wolffd@0:string | wolffd@0:
wolffd@0: | | | wolffd@0:<BR/> | wolffd@0:
wolffd@0: | | | wolffd@0:<FONT> text </FONT> | wolffd@0:
table | wolffd@0:: | wolffd@0:[ <FONT> ] <TABLE> rows </TABLE> [ </FONT> ] | wolffd@0:
rows | wolffd@0:: | wolffd@0:row | wolffd@0:
wolffd@0: | | | wolffd@0:rows row | wolffd@0:
row | wolffd@0:: | wolffd@0:<TR> cells </TR> | wolffd@0:
cells | wolffd@0:: | wolffd@0:cell | wolffd@0:
wolffd@0: | | | wolffd@0:cells cell | wolffd@0:
cell | wolffd@0:: | wolffd@0:<TD> label </TD> | wolffd@0:
wolffd@0: | | | wolffd@0:<TD> <IMG/> </TD> | wolffd@0:
wolffd@0: Above, a string is any collection of printable characters, including wolffd@0: all spaces. Note that outside of the body of a <TD> element, wolffd@0: whitespace characters are ignored; within a <TD> element, spaces wolffd@0: are preserved but all other white space characters are discarded. wolffd@0: HTML comments are allowed within an HTML string. They can occur anywhere wolffd@0: provided that, if they contain part of an HTML element, they must contain wolffd@0: the entire element. wolffd@0:
wolffd@0: As is obvious from the above description, the interpretation of white space wolffd@0: characters is one place where HTML-like labels is very different from wolffd@0: standard HTML. In HTML, any sequence of white space characters is wolffd@0: collapsed to a single space, If the user does not want this to happen, the wolffd@0: input must use non-breaking spaces " ". This makes sense in wolffd@0: HTML, where text layout depends dynamically on the space available. In wolffd@0: Graphviz, the layout is statically determined by the input, so it is wolffd@0: reasonable to treat ordinary space characters as non-breaking. In addition, wolffd@0: ignoring tabs and newlines allows the input text to be formatted for wolffd@0: easier reading. wolffd@0:
wolffd@0: Each of the HTML elements has a set of optional attributes. wolffd@0: Attribute values must appear in double quotes. wolffd@0:
<TABLE wolffd@0: ALIGN="CENTER|LEFT|RIGHT" wolffd@0: BGCOLOR="color" wolffd@0: BORDER="value" wolffd@0: CELLBORDER="value" wolffd@0: CELLPADDING="value" wolffd@0: CELLSPACING="value" wolffd@0: COLOR="color" wolffd@0: FIXEDSIZE="FALSE|TRUE" wolffd@0: HEIGHT="value" wolffd@0: HREF="value" wolffd@0: PORT="portName" wolffd@0: TARGET="value" wolffd@0: TITLE="value" wolffd@0: TOOLTIP="value" wolffd@0: VALIGN="MIDDLE|BOTTOM|TOP" wolffd@0: WIDTH="value" wolffd@0: > wolffd@0:wolffd@0:
wolffd@0:
<TR wolffd@0: <!-- No attributes --> wolffd@0: > wolffd@0:wolffd@0:
wolffd@0:
<TD wolffd@0: ALIGN="CENTER|LEFT|RIGHT|TEXT" wolffd@0: BALIGN="CENTER|LEFT|RIGHT" wolffd@0: BGCOLOR="color" wolffd@0: BORDER="value" wolffd@0: CELLPADDING="value" wolffd@0: CELLSPACING="value" wolffd@0: COLOR="color" wolffd@0: COLSPAN="value" wolffd@0: FIXEDSIZE="FALSE|TRUE" wolffd@0: HEIGHT="value" wolffd@0: HREF="value" wolffd@0: PORT="portName" wolffd@0: ROWSPAN="value" wolffd@0: TARGET="value" wolffd@0: TITLE="value" wolffd@0: TOOLTIP="value" wolffd@0: VALIGN="MIDDLE|BOTTOM|TOP" wolffd@0: WIDTH="value" wolffd@0: > wolffd@0:wolffd@0: wolffd@0:
wolffd@0:
<FONT wolffd@0: COLOR="color" wolffd@0: FACE="fontname" wolffd@0: POINT-SIZE="value" wolffd@0: > wolffd@0:wolffd@0: wolffd@0:
wolffd@0:
<BR wolffd@0: ALIGN="CENTER|LEFT|RIGHT" wolffd@0: > wolffd@0:wolffd@0: wolffd@0:
wolffd@0:
<IMG wolffd@0: SCALE="FALSE|TRUE|WIDTH|HEIGHT|BOTH" wolffd@0: SRC="value" wolffd@0: > wolffd@0:wolffd@0: wolffd@0:
wolffd@0: ALIGN wolffd@0:
wolffd@0: specifies horizontal placement. When an object is allocated wolffd@0: more space than required, this value determines where the extra space wolffd@0: is placed left and right of the object. wolffd@0:wolffd@0: wolffd@0: BALIGN wolffd@0:wolffd@0:
wolffd@0:
wolffd@0:- CENTER aligns the object in the center. (Default)
wolffd@0:- LEFT aligns the object on the left.
wolffd@0:- RIGHT aligns the object on the right.
wolffd@0:- (
wolffd@0:<TD> only) TEXT aligns lines of text using the full wolffd@0: cell width. The alignment of a line is determined by its (possibly wolffd@0: implicit) associated<BR> element.wolffd@0: The contents of a cell are normally aligned as a block. In particular, wolffd@0: lines of text are first aligned as a text block based on the width of wolffd@0: the widest line and the corresponding
<BR> elements. Then, wolffd@0: the entire text block is aligned within a cell. If, however, the wolffd@0: cell's ALIGN value is"TEXT" , and the cell contains wolffd@0: lines of text, then the lines are justified using the entire available wolffd@0: width of the cell. If the cell does not contain text, then the contained wolffd@0: image or table is centered. wolffd@0:
wolffd@0: specifies the default alignment ofwolffd@0: wolffd@0: BGCOLOR="color" wolffd@0:<BR> elements contained wolffd@0: in the cell. That is, if a<BR> element has no wolffd@0: explicit ALIGN attribute, the attribute value is specified wolffd@0: by the value of BALIGN. wolffd@0:
wolffd@0: sets the color of the background. This color can be wolffd@0: overridden by a BGCOLOR attribute in descendents. wolffd@0:wolffd@0: wolffd@0: BORDER="value" wolffd@0:
wolffd@0: specifies the width of the border around the object in points. wolffd@0: A value of zero indicates no border. The default is 1. wolffd@0: The maximum value is 255. wolffd@0: If set in a table, and CELLBORDER is not set, wolffd@0: this value is also used for all cells in the table. wolffd@0: It can be overridden by a BORDER tag in a cell. wolffd@0:wolffd@0: wolffd@0: CELLBORDER="value" wolffd@0:
wolffd@0: specifies the width of the border for all cells in a table. wolffd@0: It can be overridden by a BORDER tag in a cell. wolffd@0: The maximum value is 255. wolffd@0:wolffd@0: wolffd@0: CELLPADDING="value" wolffd@0:
wolffd@0: specifies the space, in points, between a cell's border and its content. wolffd@0: The default is 2. wolffd@0: The maximum value is 255. wolffd@0:wolffd@0: wolffd@0: CELLSPACING="value" wolffd@0:
wolffd@0: specifies the space, in points, between cells in a table and between wolffd@0: a cell and the table's border. The default is 2. wolffd@0: The maximum value is 127. wolffd@0:wolffd@0: wolffd@0: COLOR="color" wolffd@0:
wolffd@0: sets the color of the font within the scope of wolffd@0: <FONT>...</FONT>, or the border color wolffd@0: of the table or cell within the scope of wolffd@0: <TABLE>...</TABLE>, wolffd@0: or <TD>...</TD>. wolffd@0: This color can be wolffd@0: overridden by a COLOR attribute in descendents. wolffd@0: By default, the font color is determined by the wolffd@0: fontcolor attribute of wolffd@0: the corresponding node, edge or graph, and the border color wolffd@0: is determined by the wolffd@0: color attribute of wolffd@0: the corresponding node, edge or graph. wolffd@0:wolffd@0: wolffd@0: COLSPAN="value" wolffd@0:
wolffd@0: specifies the number of columns spanned by the cell. The default is 1. wolffd@0: The maximum value is 65535. wolffd@0:wolffd@0: wolffd@0: FACE="fontname" wolffd@0:
wolffd@0: specifies the font to use within the scope of wolffd@0: <FONT>...</FONT>. wolffd@0: This can be wolffd@0: overridden by a FACE attribute in descendents. wolffd@0: By default, the font name is determined by the wolffd@0: fontname attribute of the corresponding wolffd@0: node, edge or graph. wolffd@0:wolffd@0: wolffd@0: FIXEDSIZE wolffd@0:
wolffd@0: specifies whether the values given by the WIDTH wolffd@0: and HEIGHT attributes are enforced. wolffd@0:wolffd@0: wolffd@0: HEIGHT="value" wolffd@0:wolffd@0:
wolffd@0:
wolffd@0:- FALSE allows the object to grow so that all its contents will fit. (Default)
wolffd@0:- TRUE fixes the object size to its given WIDTH wolffd@0: and HEIGHT. wolffd@0: Both of these attributes must be supplied.
wolffd@0:
wolffd@0: specifies the mininum height, in points, of the object. The height wolffd@0: includes the contents, any spacing and the border. Unless wolffd@0: FIXEDSIZE is true, the height will be expanded to allow wolffd@0: the contents to fit. wolffd@0: The maximum value is 65535. wolffd@0:wolffd@0: wolffd@0: HREF="value" wolffd@0:
wolffd@0: attaches a URL to the object. wolffd@0:wolffd@0: wolffd@0: POINT-SIZE="value" wolffd@0:
wolffd@0: sets the size of the font, in points, used within the scope of wolffd@0: <FONT>...</FONT>. wolffd@0: This can be wolffd@0: overridden by a POINT-SIZE attribute in descendents. wolffd@0: By default, the font size is determined by the wolffd@0: fontsize attribute of the corresponding wolffd@0: node, edge or graph. wolffd@0:wolffd@0: wolffd@0: PORT="value" wolffd@0:
wolffd@0: attaches a portname to the object. wolffd@0: (See portPos.) wolffd@0: This can be used to modify the head wolffd@0: or tail of an edge, so that the end attaches directly to the object. wolffd@0:wolffd@0: wolffd@0: ROWSPAN="value" wolffd@0:
wolffd@0: specifies the number of rows spanned by the cell. The default is 1. wolffd@0: The maximum value is 65535. wolffd@0:wolffd@0: wolffd@0: SCALE wolffd@0:
wolffd@0: specifies how an image will use any extra space available in its cell. wolffd@0: Allowed values are wolffd@0:wolffd@0: wolffd@0: SRC="value" wolffd@0:wolffd@0:
wolffd@0: If this attribute is undefined, wolffd@0: the image inherits the imagescale wolffd@0: attribute of the graph object being drawn. wolffd@0: As with the imagescale wolffd@0: attribute, if the cell has a fixed size and the image is too large, wolffd@0: any offending dimension will be shrunk to fit the space, the wolffd@0: scaling being uniform in width and height if SCALE="true". wolffd@0:- FALSE : keep image its natural size. (Default)
wolffd@0:- TRUE : scale image uniformly to fit.
wolffd@0:- WIDTH : expand image width to fill
wolffd@0:- HEIGHT : expand image height to fill
wolffd@0:- BOTH : expand both image width height to fill
wolffd@0:
wolffd@0: specifies the image file to be displayed in the cell. wolffd@0: Note that if the software is used as a web server, file system access wolffd@0: to images is more restricted. See GV_FILE_PATH wolffd@0: and SERVER_NAME. wolffd@0:wolffd@0: wolffd@0: TARGET="value" wolffd@0:
wolffd@0: determines which window of the browser is used for the URL if the object wolffd@0: has one. wolffd@0: See W3C documentation. wolffd@0:wolffd@0: wolffd@0: TITLE="value" wolffd@0:
wolffd@0: sets the tooltip annotation attached to the element. wolffd@0: This is used only if the element has a HREF attribute. wolffd@0:wolffd@0: wolffd@0: TOOLTIP="value" wolffd@0:
wolffd@0: is an alias for TITLE. wolffd@0:wolffd@0: wolffd@0:
wolffd@0: VALIGN wolffd@0:
wolffd@0: specifies vertical placement. When an object is allocated wolffd@0: more space than required, this value determines where the extra space wolffd@0: is placed above and below the object. wolffd@0:wolffd@0: wolffd@0: WIDTH="value" wolffd@0:wolffd@0:
wolffd@0:
wolffd@0:- MIDDLE aligns the object in the center. (Default)
wolffd@0:- LEFT aligns the object on the left.
wolffd@0:- RIGHT aligns the object on the right.
wolffd@0:
wolffd@0: specifies the mininum width, in points, of the object. The width wolffd@0: includes the contents, any spacing and the border. Unless wolffd@0: FIXEDSIZE is true, the width will be expanded to allow wolffd@0: the contents to fit. wolffd@0: The maximum value is 65535. wolffd@0:wolffd@0: wolffd@0:
wolffd@0: There is some inheritance among the attributes. If a table specifies wolffd@0: a CELLPADDING, CELLBORDER or BORDER wolffd@0: value, this value is used by the table's wolffd@0: cells unless overridden. If a cell or table specifies a BGCOLOR, wolffd@0: this will be the background color for all of its descendents. wolffd@0: Of course, if a background or fill color is specified for the wolffd@0: graph object owning the label, this will be the original wolffd@0: background for the label. wolffd@0: The object's fontname, fontcolor and fontsize attributes wolffd@0: are the default for drawing text. These can be overridden by using wolffd@0: FONT to set new values. The new font values will hold wolffd@0: until overridden by an enclosed FONT element. wolffd@0: Finally, the pencolor or color of the graph object will be used as wolffd@0: the border color. wolffd@0:
wolffd@0: Because of certain limitations in handling tables in a device-independent wolffd@0: manner, when BORDER is 1 and both table and cell borders wolffd@0: are on and CELLSPACING is less than 2, anomalies can arise wolffd@0: in the output, such as gaps between sides of borders which should be wolffd@0: abutting or even collinear. The user can usual get around this by increasing wolffd@0: the border size or the spacing, or turning off the table border. wolffd@0:
wolffd@0: As an example of HTML labels, the dot input wolffd@0:
left | mid dle | right |
one | two |
hello world |
wolffd@0: b | wolffd@0:g | wolffd@0:h | wolffd@0:||
c | d | e | wolffd@0:|||
f | wolffd@0:
wolffd@0: As usual, an HTML specification is more verbose. On the other hand, wolffd@0: HTML labels are much more general, as the following example shows: wolffd@0:
wolffd@0: wolffd@0:
wolffd@0: The source for this graph can be found here. wolffd@0:
wolffd@0: Here is an example using <FONT> elements wolffd@0:
wolffd@0: wolffd@0:
wolffd@0: with the input graph. wolffd@0:
wolffd@0: Here is an example using an <IMG> element wolffd@0:
wolffd@0: wolffd@0:
wolffd@0: with the input graph. wolffd@0: wolffd@0:
wolffd@0: The table below wolffd@0: gives the shape names and the corresponding node shapes. wolffd@0: wolffd@0: wolffd@0: