Subject: | Allow full range of values for rankdir |
The attached patch against GraphViz 2.04 permits right-to-left and
bottom-to-top graph layouts.
Subject: | graphviz-rankdir.patch |
--- lib/GraphViz.pm~ 2010-11-25 16:58:17.000000000 +0000
+++ lib/GraphViz.pm 2010-11-25 18:05:16.000000000 +0000
@@ -169,8 +169,10 @@
=item rankdir
Another attribute 'rankdir' controls the direction the nodes are linked
-together. If true it will do left->right linking rather than the
-default up-down linking.
+together. Possible values are "TB", "LR", "BT", "RL", corresponding to
+directed graphs drawn from top to bottom, from left to right, from
+bottom to top, and from right to left, respectively. The default is left
+to right.
=item width, height
@@ -1092,7 +1094,12 @@
$dot .= $graph_type . " " . $self->{NAME} . " {\n";
# the direction of the graph
- $dot .= "\trankdir=LR;\n" if $self->{RANK_DIR};
+ if ( $self->{RANK_DIR} =~ m/^(?:LR|RL|TB|BT)$/ ) {
+ $dot .= "\trankdir=" . $self->{RANK_DIR} . ";\n";
+ }
+ elsif ( $self->{RANK_DIR} ) {
+ $dot .= "\trankdir=LR;\n";
+ }
# the size of the graph
$dot .= "\tsize=\"" . $self->{WIDTH} . "," . $self->{HEIGHT} . "\";\n"