我一直在尝试使用Tk::GraphViz
.
我有以下代码:
use strict;
use warnings;
use Tk::GraphViz;
use Tk;
my $graph ='graph PathsOfPin {
a [label = "aaa"];
b [label = "bbb"];
c [label = "ccc"];
d [label = "ddd"];
e [label = "eee"];
f [label = "fff"];
a--b;
c--d;
e--f;
b--c;
d--e;
}';
my $mw = new MainWindow();
my $gv = $mw->GraphViz ( qw/-width 800 -height 800/ )->pack ( qw/-expand yes -fill both/ );
$gv->fit(); # This does nothing - down't affect the view
$gv->zoom( -in => 100 ); # This gives me error
$gv->show ( $graph );
MainLoop;
当我尝试在没有fit
and的情况下运行代码时zoom
,我得到了这个非常小的图形(看起来像一个点),我需要用鼠标将其放大几次,直到我看到它。
- 我尝试了
fit
,它应该适合图表查看 - 但它并没有真正起作用。 当我尝试使用 对缩放进行硬编码时
$gv-zoom
,出现以下错误:Tk::Error: Can't set -scrollregion to ARRAY(0xbb8d30) for Tk::GraphViz=HASH(0xd1bbb0): bad scrollRegion "???" at /5.8.5/lib/site_perl/5.8.5/x86_64-linux/Tk/Configure.pm line 46. at /5.8.5/lib/site_perl/5.8.5/x86_64-linux/Tk/Derived.pm line 294 Tk callback for . Tk callback for .graphviz Tk callback for .graphviz Tk::Derived::configure at 5.8.5/lib/site_perl/5.8.5/x86_64-linux/Tk/Derived.pm line 306 Tk::GraphViz::_scaleAndMoveView at GraphViz.pm line 1445 Tk::GraphViz::zoom at Tk/GraphViz.pm line 1864 Can't set -scrollregion to ARRAY(0xbb8d30) for Tk::GraphViz=HASH(0xd1bbb0): bad scrollRegion "???" at 5.8.5/x86_64-linux/Tk/Configure.pm line 46. at 5.8.5/x86_64-linux/Tk/Derived.pm line 294
将图形自动适合缩放的更好方法是什么?