GraphViz is a way of representing structural information as diagrams
of abstract graphs and networks. Automatic graph drawing has many important
applications in software engineering, database and web design, networking, and
in visual interfaces for many other domains.
This plugin uses Graphviz's applications to
create an image of a directed graph. The directed graph is described using a
simple text markup called "The DOT Language". This markup is written between
<graphviz> and </graphviz> tags or using the %GRAPHVIZ macro.
By default, an svg image attachment is created and displayed inline, replacing the <graphviz> markup.
Visit the Graphviz gallery to see some
examples on what can be achieved with this plugin and Graphviz.
Full documentation is available at https://graphviz.org/documentation.
Usage
There are two ways to specify a graph:
using the <graphviz> xml tag
using the %GRAPHVIZ Foswiki macro
Both can be used to generate a graph inline, that is by specifying the DOT language as part of the page. Below
examples are mostly equivalent:
<graphviz renderer="dot" type="png">
digraph G {Hello[fontcolor="red"]; Hello->World}
</graphviz>
%GRAPHVIZ{
"digraph G {Hello[fontcolor=\"red\"]; Hello->World}"
renderer="dot"
type="png"
}%
Both should render as
when installed.
The <graphviz> xml syntax has got the advantage of being in line with other wikis, such as dokuwiki. Also,
the DOT code does not have to escape any double-quotes (") as is the case using the Foswiki macro way.
However using a proper %GRAPHVIZ macro has got the advantage of being well integrated into Foswiki's Topic Markup Language.
For instance it can be properly escaped when in a FormattedSearch.
For compatibility with DirectedGraphPlugin you may use <dot> instead of <graphviz>.
attachment that may hold a .gv graph file (only available in %GRAPHVIZ)
section=" … "
named section in topic that holds a graph description (only available in %GRAPHVIZ)
library="[web.]topic"
specify the topic where to search for images to be used in the dot graph
topic
inline="on|off"
boolean flag to specify the way how to add an svg result to the html page; if inline="on" then an <svg> html tag is generated; otherwise an html <img … > tag is used; note that for properly linking URLs in the graphviz graph you will need to switch this on
off
expand="on|off"
boolean flag, when switched on, will expand TML macros in the DOT code before rendering it
off
style=" … "
css styles to be added to the output
width=" … "
width of the image result
height=" … "
height of the image result
Graphviz from Table
Instead of having to learn the dot language, nodes and edges can also be specified in Foswiki tables:
%STARTSECTION{"example1"}%
digraph G {
node [fontname=Verdana,
fontsize=12,
style=filled,
fillcolor="#EEEEEE",
color="#EEEEEE"]
edge [fontname=Verdana,
fontsize=10,
color="#31CEF0"]
main [shape=box, color=deeppink]
init [shape=box, color=deeppink]
main -> parse -> execute [weight=8]
main -> init [taillabel="%main_init_label{default=""}%",
labelangle=-20,
labeldistance=7,
color=deeppink,
arrowhead=vee,
arrowtail=vee]
main -> cleanup
main -> printf [taillabel="%main_printf_label{default=""}%",
labelangle=15,
labeldistance=7]
execute -> make_string
execute -> printf
init -> make_string
execute -> compare
}
%ENDSECTION{"example1"}%
Example 2
Installation Instructions
You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.
Open configure, and open the "Extensions" section. "Extensions Operation and Maintenance" Tab → "Install, Update or Remove extensions" Tab. Click the "Search for Extensions" button.
Enter part of the extension name or description and press search. Select the desired extension(s) and click install. If an extension is already installed, it will not show up in the
search results.
You can also install from the shell by running the extension installer as the web server user: (Be sure to run as the webserver user, not as root!)
cd /path/to/foswiki
perl tools/extension_installer <NameOfExtension> install