Skip Menu |

This queue is for tickets about the GraphViz CPAN distribution.

Report information
The Basics
Id: 30708
Status: resolved
Priority: 0/
Queue: GraphViz

People
Owner: Nobody in particular
Requestors: RUZ [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: [PATCH] Add name argument to the constructor
Hi, In the attachment you can find a patch that makes name of a graph configurable. This option is very useful if you want to show many graphs on a page with client side image maps. -- Best regards, Ruslan.
Subject: gviz-2.02-graph_name.patch
Only in GraphViz-2.02-my/: Makefile Only in GraphViz-2.02-my/: blib diff -ur GraphViz-2.02/lib/GraphViz.pm GraphViz-2.02-my/lib/GraphViz.pm --- GraphViz-2.02/lib/GraphViz.pm 2005-01-07 21:24:54.000000000 +0300 +++ GraphViz-2.02-my/lib/GraphViz.pm 2007-11-14 01:22:33.000000000 +0300 @@ -313,6 +313,12 @@ and 1, or an X11 color name such as 'white', 'black', 'red', 'green', 'blue', 'yellow', 'magenta', 'cyan', or 'burlywood'. +=item name + +The 'name' option sets name of the graph. This option is useful in few +situations, like client side image map generation, see cmapx. +By default 'test' is used. + =item node,edge,graph The 'node', 'edge' and 'graph' attributes allow you to specify global @@ -357,6 +363,12 @@ $self->{LAYOUT} = "dot"; # default layout } + if (exists $config->{name}) { + $self->{NAME} = $config->{name}; + } else { + $self->{NAME} = 'test'; + } + if (exists $config->{bgcolor}) { $self->{BGCOLOR} = $config->{bgcolor}; } @@ -875,14 +887,14 @@ =item as_cmap (deprecated) Returns a string which contains a layed-out HTML client-side image map -format file. Use as_cmpax instead. +format file. Use as_cmapx instead. print $g->as_cmap; =item as_cmapx Returns a string which contains a layed-out HTML HTML/X client-side image map -format file. +format file. Name and id attributes of map element are set to name of the graph. print $g->as_cmapx; @@ -987,7 +999,7 @@ my $graph_type = $self->{DIRECTED} ? 'digraph' : 'graph'; - $dot .= "$graph_type test {\n"; + $dot .= $graph_type ." ". $self->{NAME} ." {\n"; # the direction of the graph $dot .= "\trankdir=LR;\n" if $self->{RANK_DIR}; Only in GraphViz-2.02-my/: pm_to_blib
Thanks, this patch is in GraphViz 2.03.