Gtk2::Ex::GraphViz - A Gtk2 wrapper to the GraphViz.pm module.
GraphViz can be used to produce good-looking network graphs. Wrapping with Gtk2 allows those images to respond to events such as mouse-over, clicked etc.
mouse-over
clicked
By implementing callbacks to the respective signals, you can create fairly interactive network graphs. For example, when the user double-clicks a node, you can open up a widget that contains information on that node.
signals
use GraphViz; use Gtk2::Ex::GraphViz; my $g = GraphViz->new; # First do all the work in GraphViz.pm $g->add_node('London', shape => 'box', fillcolor =>'lightblue', style =>'filled',); $g->add_node('Paris', label => 'City of\nlurve', ); $g->add_edge('London' => 'Paris'); # Now the actual Gtk2::Ex::GraphViz portion takes over my $graphviz = Gtk2::Ex::GraphViz->new($g); $graphviz->signal_connect ('mouse-enter-node' => sub { my ($self, $x, $y, $nodename) = @_; my $nodetitle = $graphviz->{svgdata}->{g}->{g}->{$nodename}->{title}; print "Node : $nodetitle : $x, $y\n"; } );
The constructor accepts a GraphViz object as the first argument.
my $g = GraphViz->new; # First do all the work in GraphViz.pm my $graphviz = Gtk2::Ex::GraphViz->new($g);
Returns the widget that can be added to any container and presented in a window.
See the SIGNALS section to see the supported signals.
GraphViz
Copyright 2005 Ofey Aikon, All Rights Reserved.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA.
To install Gtk2::Ex::GraphViz, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Gtk2::Ex::GraphViz
CPAN shell
perl -MCPAN -e shell install Gtk2::Ex::GraphViz
For more information on module installation, please visit the detailed CPAN module installation guide.