Extension:Graph

From MediaWiki.org

Jump to: navigation, search
Manual on MediaWiki Extensions
List of MediaWiki Extensions
Graph

Release status: unknown

Implementation Tag
Description takes a textual graph description between <graph> </graph> tags and turns it into a pretty flowchart diagram.
Download bloodgate.com

Contents

[edit] Overview

The graph-extension takes a textual graph description between <graph> </graph> tags, and turns it into a pretty flowchart diagram.

It works much like the GraphViz extension, except that it outputs ASCII, HTML, SVG or Graphviz code. The latter then allows rendering of PNG files.

The advantage of textual, SVG or HTML output over an image is that it makes it possible to easily include mouse-over titles and links in the graph, as well as make the graph scalable and zoomable. In addtion, copy & paste is possible, and search engines will index the text in the graph like the node names and edge labels.

Please see also the overview in the manual.

[edit] Input

The input can either be in the own format of Graph::Easy, or in the DOT language used by Graphviz. You do not need the dot tools for parsing either format:

Graph::Easy:

[ Bonn ] --> { style: bold; } [ Berlin ]

DOT:

digraph G {
 "Bonn" --> "Berlin" [ style: bold; ]
}

[edit] Output

The output can be in ASCII art drawings, Unicode boxcode drawings, HTML or SVG. If you have graphviz installed, you can also render PNG files via dot, neato etc.

[edit] Examples

Here is an example, as HTML rendered by Firefix (shown as screenshot due to Meta not allowing <style> </style>)

node { fill: #ffdead; }

[ Berlin ] { fill: #f06060; color: white; } 
  -> [ Rostock ], [ Dresden ], [ Magdeburg ], [ Frankfurt (Oder) ]
 
[ Magdeburg ] .. train ..> [ Aschaffenburg ] { fill: #e0e0ff; border: bold; }

Image:Graph extension example.png

Since it is not yet possible to upload SVG files to Meta, please see this SVG example.

[edit] Details & Feedback

The extension uses a Perl module called Graph::Easy to parse the input and render the output.

Much more details, documentation, the actual code, examples and testcases can be found at my site.

This is work in progress - but feedback is very much welcome.

[edit] External Links

Personal tools