1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#!/usr/bin/perl -w
use Chart::LinesPoints;
use strict;
print "1..1\n";
my ( @data, @data2, @labels, %hash, $g, $hits );
# create an array of labels
for ( 0 .. 30 )
{
push( @labels, $_ );
}
# create two arrays of data
for ( 0 .. 30 )
{
#first array
$hits = 2 * $_;
if ( $_ % 2 == 0 )
{
$hits = $_;
}
push( @data, $hits );
#second array
$hits = 40 - $_ + 10 * cos($_);
push( @data2, $hits );
}
$g = Chart::LinesPoints->new( 600, 300 );
$g->add_dataset(@labels);
$g->add_dataset(@data);
$g->add_dataset(@data2);
%hash = (
'title' => 'Lines with Points Demo',
'y_axes' => 'both',
'legend' => 'none',
'precision' => 0,
'xy_plot' => 'true',
);
$g->set(%hash);
$g->png("samples/linespoints_2.png");
print "ok 1\n";
exit(0);
|