Ok, it returns a string, a path, but every such tk path is an object if given to Tkx::widget->new()
#!/usr/bin/perl --
use strict; use warnings;
use Tkx;
local $Tkx::TRACE=64;
Tkx::package_require(q/Plotchart/);
my $mw = Tkx::widget->new(".");
my $canvas = $mw->new_tk__canvas( qw/-background white /);
$canvas->g_pack(qw/ -expand 1 -fill both /);
my $s = Tkx::Plotchart__createXYPlot($canvas, [qw{0.0 100.0 10.0}], [
+qw{0.0 100.0 20.0}] );
$s = Tkx::widget->new( $s );
my @xy = qw{0.0 32.0 10.0 50.0 25.0 60.0 78.0 11.0 };
for( my $ix = 0; $ix < @xy; $ix+=2 ){
my $x = $xy[$ix];
my $y = $xy[$ix+1];
$s->plot("series1", $x, $y);
}
$s->title("Data series");
$mw->g_wm_withdraw();
$mw->g_wm_deiconify();
Tkx::MainLoop();
__END__
#~ http://tcllib.sourceforge.net/doc/plotchart.html
#~ package require Plotchart
#~
#~ canvas .c -background white -width 400 -height 200
#~ pack .c -fill both
#~
#~ #
#~ # Create the plot with its x- and y-axes
#~ #
#~ set s [::Plotchart::createXYPlot .c {0.0 100.0 10.0} {0.0 100.0
+ 20.0}]
#~
#~ foreach {x y} {0.0 32.0 10.0 50.0 25.0 60.0 78.0 11.0 } {
#~ $s plot series1 $x $y
#~ }
#~
#~ $s title "Data series
__END__
Tkx-1-0.0s---5: package require Plotchart
Tkx-2-0.1s---7: winfo children .
Tkx-3-0.1s---7: tk::canvas .c -background white
Tkx-4-0.1s---8: pack .c -expand 1 -fill both
Tkx-5-0.1s---9: Plotchart::createXYPlot .c [list 0.0 100.0 10.0] [list
+ 0.0 100.0 20.0]
Tkx-6-0.1s---16: xyplot_.c plot series1 0.0 32.0
Tkx-7-0.1s---16: xyplot_.c plot series1 10.0 50.0
Tkx-8-0.1s---16: xyplot_.c plot series1 25.0 60.0
Tkx-9-0.1s---16: xyplot_.c plot series1 78.0 11.0
Tkx-10-0.1s---18: xyplot_.c title {Data series}
Tkx-11-0.1s---20: wm withdraw .
Tkx-12-0.1s---21: wm deiconify .
|