If you haven't done so, please read the Overview first.
This chapter describes the possible output formats and their limitations, strengths and weaknesses.
Formats
Graph::Easy can create the following output formats:
- txt - a dump of the graph as a textual description, parsable by Graph::Easy::Parser
- graphviz - a dump of the graph in the graphviz format. This can be feed to external programs like dot to generate PNG, SVG etc.
- ASCII - creates an ASCII art "drawing" of the graph
- HTML - outputs HTML+CSS code (actually a big table) to render the graph in your browser
- SVG - creates Scalable Vector Graphics output
ASCII
The ASCII output is limited to only two colors, one for the foreground, and one for the background.
#============================================# H v +---------+ ........ +---------+ +--------+ +--------+ | Bautzen | --> : Bonn : --> | Koblenz | --> | Berlin | --> | Kassel | +---------+ :......: +---------+ +--------+ +--------+ ^ | ^ ^ : +------------+---------------+ : | : +------+ | ............. | Ulm | ------+ +------+
In addition, the arrows are always rendered open, regardless of the actual arrow style.
Node shapes with slanted or round borders are not yet supported in ASCII.
HTML
The following table shows the main features and their support in the main browsers.
Feature | Opera | Mozilla Firefox |
Konqueror | IE |
---|---|---|---|---|
Node shapes: rounded, circle, ellipse |
No | Yes | No | No |
Nodes with angled borders: diamond, house, triangle, etc. |
No | Yes | Yes | 5.x + |
Node shape: point | No | Yes | Yes | 5.x + |
Gapless edges | Yes | Yes | Yes | Yes |
Padding between graph content and border | Yes | Yes | 3.4 + | No |
Here is a sample graph:
Test label | |||||||||||||||||||||||||||||||
v | |||||||||||||||||||||||||||||||
> | Five | > | Seven | Eight | None | ||||||||||||||||||||||||||
^ | |||||||||||||||||||||||||||||||
> | Three | < | One | label | > | Two | > | Four | |||||||||||||||||||||||
^ | Test label |
^ | |||||||||||||||||||||||||||||
Test label | |||||||||||||||||||||||||||||||
v | |||||||||||||||||||||||||||||||
Six | |||||||||||||||||||||||||||||||
SVG
Some SVG renders, notable Opera, do not support center-aligned text. Since
this is used to render node labels, these will appear off-center. Likewise,
Opera 8.02 does not support tspan
at all. This means multi-line
labels will be missing.
There is nothing that can be done about except for SVG renderes finally
supporting the full spec instead of some random subset.
Otherwise, the SVG output is mainly complete. If you notice any feature missing or not working, please open a bug report.
Graphviz
Graph::Easy also allows the output of Graphviz code, which can be feed to an
external program like dot
or neato
to create
.png
, .ps
, .svg
or many other
file formats:
perl examples/as_graphviz my_graph.txt | dot -Tpng -o graph.png perl examples/as_graphviz my_graph.txt | dot -Tsvg -o graph.svg
The output to graphviz does not yet take some features of Graph::Easy into account. The reason is that graphviz works differently than Graph::Easy and at the moment there seems no easy way to implement this. Here is a short list of features that are incomplete:
- nodes that are placed relatively to each other
- multi-celled nodes
- per-node flow directions (flow for the entire graph will work, though)
- grouping of nodes
In addition, the following output styles are not yet supported. These probably can be emulated with some graphviz-fu, but there was not enough time to find out how:
- border/edge styles:
double
,dot-dash
,dot-dot-dash
,double-dash
,wave
- filled edge arrows with different fill colors
- node shape: point with other point-styles than "circle"