Graphviz extension
From Wickle Wiki
I have recently (2-oct-2004) created a extension to mediawiki in response to a basic need : Render Graphs online
I found the utility graphviz on another wiki , and i think on adopting it to mediawiki (the wiki i actually use ) exploring the Graphviz tool i discover an incredible tool to making Graphs. Automatic graph drawing has many important applications in software engineering, database and web design, networking, and in visual interfaces for many other domains.
You can view a lot of samples here , at the original page.
Of course the only requisite for this plugin to work is the graphviz program, you can download it from here
You can find information on how to write a graph on the original page at here
Contents |
Changelog
Version 1.1 (27-jan-05)
- links on the shapes are renderized too
Version 1.0 (10-oct-04)
- Graphviz allows to represent graphs on mediawiki based sites
Requisites
Graphviz 1.12, download from here
Download
- Download the extension from Sourceforge CVS (primary)
- Alternatively, download from my CVS at wickle.com
Install instructions
you must copy Graphviz.php to $mediawiki/extensions directory and add this line to LocalSettings.php: include("extensions/Graphviz.php");
Also you must set $wgGraphVizSettings->dotCommand = "/usr/local/bin/dot"; to accomplish your installation of graphviz.
- This parameter may vary with the standard settings on various distributions. If you install GraphViz on Suse, for instance, you will have to set $wgGraphVizSettings->dotCommand = "/usr/bin/dot";.
Syntax
The syntax is very simple , just look at the samples ...
if you need more info look here.
Samples
Simple sample
<graphviz>
digraph G {Hello->World!}
</graphviz>
<graphviz>
digraph G {
size ="4,4";
main [shape=box]; /* this is a comment */
main -> parse [weight=8];
parse -> execute;
main -> init [style=dotted];
main -> cleanup;
execute -> { make_string; printf}
init -> make_string;
edge [color=red]; // so is this
main -> printf [style=bold,label="100 times"];
make_string [label="make a\nstring"];
node [shape=box,style=filled,color=".7 .3 1.0"];
execute -> compare;
}
</graphviz>
A sample directory structure generated by a Perl code program:
More Sample with links
<graphviz>
digraph G {
Perl [URL="Perl code"];
Java [URL="Java rocks"];
Perl -> Java
}
</graphviz>
How to make autolinks (all nodes)
You can automatically link all nodes without an own URL tag to a certain baseurl. In this example, all nodes X are linked to http://en.wikipedia.org/wiki/X . Contributed by --Wikinaut 21:37, 25 Mar 2005 (CET)
<graphviz>
digraph G { node [URL="http://en.wikipedia.org/wiki/\N"];
Perl -> Java
}
</graphviz>
Inline Images
It is possible to add images to the graphviz nodes. This can be very useful for producing visual content. This is a bit of a hack at the moment and I can't seem to get it working with .svg or .ps files but it can be done with .png or .jpg by adding the file path to the shapefile definition, for example [shapefile = "/var/www/mediawiki/images/3/32/Pituitaryspot.png"]; The problem with this is that it requires the user to know the filetree of the wikimedia server.

