Wgraph:Manual

From FollowTheScore
Jump to: navigation, search
Manual Index

Wgraph is a Mediawiki extension which can generate graphs.

Commands on node / edge level

  • All the following commands operate on node or edge level. They cannot be used outside a node or edge definition.
  • The arguments of identical statements overwrite each other so that the last statement wins.
  • Text arguments must be quoted if they contain a space or comma.

[node,edge]   textwidth

textwidth : <tw>            where <tw> is a positive number       default = 15

wgraph tries to break a text into lines at certain special characters. Lines are at least <tw> characters long. Special characters are blank, and ",-(;/" plus some others.

Commands on graph level that refer to nodetypes and edge types

  • All the following commands operate on graph level. They cannot be used inside a node or edge definition.
  • The arguments of identical statements are merged. This means that (skip_nodetypes x,z skip_nodetypes a,b) and (skip_nodetypes x,z,a,b) are equivalent.
  • Lists must quoted if they contain spaces.
  • List elements are separated by comma, surrounded by optional spaces


[graph]   nodetypes

nodetypes : "comma separated list of (node) type names"

This command is used to define the order in which the layout attributes of nodetypes are applied to nodes. Note that a node can belong to more than one type. Once a node attribue is set it will not be overwritten by conflicting attributes of types which come later in the priority order.

If no "nodetypes" statement is found the order of applying layout attributes will be determined by the sequence in which the nodetype definitions appear in the WGL code.


[graph]   edgetypes

edgetypes : "comma separated list of (edge) type names"

This works for edges the same way as 'nodetypes' works for nodes.


[graph]   hide_nodetypes

hide_nodetypes : "comma separated list of (node) type names"

Nodes which belong to one of the specified types will be made invisible. Note that they are still there and influence the layout. This is useful if you want to maintain graph layout and just want to "switch off" nodes of a certain type. As a consequence, all edges connected to invisible nodes will be made invisible, too.


[graph]   hide_edgetypes

hide_edgetypes : "comma separated list of (edge) type names"

Edges which belong to one of the specified types will be made invisible. Note that they are still there and influence the layout. This is useful if you want to maintain graph layout and just want to "switch off" edges of a certain type. If, as a consequence, certains nodes would only be connected to invisible edges these nodes will be made invisible, too.


[graph]   show_nodetypes

show_nodetypes : "comma separated list of (node) type names"

Only nodes which belong to one of the specified types will be displayed. All other nodes will be skipped (i.e. thrown away). As a consequence, all edges connected to skipped nodes will be thrown away, too. Note that the layout will be calculated based on the remaining nodes and edges only.


[graph]   show_edgetypes

show_edgetypes : "comma separated list of (edge) type names"

Only edges which belong to one of the specified types will be displayed. All other edges will be skipped (i.e. thrown away). As a consequence, all nodes which would only be connected to skipped edges will be thrown away, too. Note that the layout will be calculated based on the remaining nodes and edges only.


[graph]   skip_nodetypes

skip_nodetypes : "comma separated list of (node) type names"

Nodes which belong to one of the specified types will not be displayed. They will be thrown away and will not influence the layout. As a consequence, all edges connected to skipped nodes will be thrown away, too. Note that the layout will be calculated based on the remaining nodes and edges only.


[graph]   skip_edgetypes

skip_edgetypes : "comma separated list of (edge) type names"

Edges which belong to one of the specified types will not be displayed. They will be thrown away and will not influence the layout. As a consequence, all nodes which would only be connected to skipped edges will be thrown away, too. Note that the layout will be calculated based on the remaining nodes and edges only.





Commands on graph level that refer to nodes

  • All the following commands operate on graph level. They cannot be used inside a node or edge definition.
  • The arguments of identical statements are merged. This means that (skip_nodes x skip_nodes y) and (skip_nodes x,y) are equivalent.
  • Lists must quoted if they contain spaces.
  • List elements are separated by comma, surrounded by optional spaces

[graph]   hide_nodes

hide_nodes : "comma separated list of node names"

The nodes mentioned will be made invisible. Note that they are still there and influence the layout. This is useful if you want to maintain graph layout and just want to "switch off" certain nodes. As a consequence, all edges connected to invisible nodes will be made invisible, too.


[graph]   show_nodes

show_nodes : "comma separated list of node names"

Only the nodes mentioned will be displayed. All other nodes will be skipped (i.e. thrown away). As a consequence, all edges connected to skipped nodes will be thrown away, too. Note that the layout will be calculated based on the remaining nodes and edges only.


[graph]   skip_nodes

skip_nodes : "comma separated list of node names"

The nodes mentioned will not be displayed. They will be thrown away and will not influence the layout. As a consequence, all edges connected to skipped nodes will be thrown away, too. Note that the layout will be calculated based on the remaining nodes and edges only.

Other Commands on Graph Level

xscale, yscale, xoffset, yoffset

xscale : int
yscale : int
xoffset : int
yoffset : int

This must be specified at the beginning of a graph. All coordinates are translated:

x´ = (x - xoffset) * xscale
y´ = (y - yoffset) * yscale

where x,y are node attributes and x´,y´ are the coordinates used for drawing. 'width' and 'height' will be multiplied by xscale resp. yscale.


xclipat, yclipat, xclipsize, yclipsize

xclipat   : int
yclipat   : int
xclipsize : int
yclipsize : int

This must be specified at the beginning of a graph. Only the selected part of the graph will be painted. Selection starts at 'xclipat,yclipat' and has a size of 'xclipsize,yclipsize'. If size is not specified, the remainder of the graph will be drawn. If only one coordinate is used, the other one will remain unclipped. The clipping cuts off objects at the clip border.

Example:

node a {x 20  y 20 width 80 height 40 }
node b {x 110 y 20 width 80 height 40 }
node c {x 220 y 20 width 80 height 40 }
node 1 {x 165 y 5  width 5  height 5 label  color yellow borderwidth 0 }
node 2 {x 170 y 5  width 5  height 5 label  color red borderwidth 0 }
node 3 {x 175 y 5  width 5  height 5 label  color green borderwidth 0 }
xclipat 170

This will show

  • part of node b
  • node c
  • a red and a green dor (nodes 2 & 3)

{{#wgraph:name=Manual_clip|png|thumb=80|svg|

node a {x 20  y 20 width 80 height 40 }
node b {x 110 y 20 width 80 height 40 }
node c {x 220 y 20 width 80 height 40 }
node 1 {x 165 y 5  width 5  height 5 label  color yellow borderwidth 0 }
node 2 {x 170 y 5  width 5  height 5 label  color red borderwidth 0 }
node 3 {x 175 y 5  width 5  height 5 label  color green borderwidth 0 }
xclipat 170

}}